The beasts had strayed from the Nairobi National Park and entered a pen where the sheep and goats were locked for the night at Elkeek-Lemedungi Village early Wednesday.
The animals killed the livestock at around 1am (+3GMT) before the agitated herders speared the lions to death.
The owner raised the alarm and locals surrounded the home. However, two of the lions managed to escape.
One person was injured after a lion bit him in the arm. The locals kept vigil for about five hours to ensure none of the cats fled.
At around 3am, three Kenya Wildlife Service (KWS) game rangers arrived to restrain the locals from killing the lions.
A ranger, who spoke on condition of anonymity, said the villagers killed the cats in a span of 10 minutes.
“We killed them in less than 10 minutes because KWS were slow to act,” said a resident. Kitengela Elparago Land Owners Association James ole Turere accused KWS of declining to work with the community to protect their livestock.
“We have reported several cases about livestock killed by the beasts but nothing much has been done,” he said.
The human wildlife conflict has been of grave concern in the area.
According to the Nairobi National Park senior warden Mark Cheruiyot the action of the locals was wrong and would not be tolerated.
He blamed the residents for killing the lions in order to claim compensation.