The Bodhisatta was once a merchant. One day he was at a carpenter’s home in a far-away village when the man, while planing wood, got bit on the head by a mosquito. The carpenter told his son to swat it and so the boy picked up an axe and hit the mosquito, splitting open his father’s head and killing him instantly. The Bodhisatta, who saw this happen, told those around him that smart enemies are better than stupid friends because the fear of vengeance stops a smart enemy from killing someone.
In the Lifetime of the Buddha
The Buddha, while out on an alms pilgrimage, came to a village with a great number of wounded men. He asked people what had happened. They explained that the mosquitos in the jungle bothered them immensely, so many of the villagers declared war on the mosquitos and went to attack them. When they fired their bows, the arrows struck each other, not the mosquitos.
The Buddha told the assembled villagers this story because the carpenter and his idiot son were earlier births of two of the stupid villagers here.