Despite his wealth and splendor, King Dasharatha was unhappy because he had no children to continue his dynasty. His ministers and royal priests proposed that he conduct a Putrakameshti Yagya in order to bear a child.
Sumantra suggested inviting Sage Shringi to conduct the yagya, which took place on the Sarayu riverbank in Ayodhya. During the ritual, the gods approached Lord Vishnu and pleaded, "O Lord, the demons and their king, Ravana, have become exceedingly powerful and threaten the existence of gods and humans alike. King Dasharatha is currently conducting a yagya to beget children. Please be born as four sons to him and his queens and vanquish the demons."
Vishnu graciously agreed. At his behest, the fire god, Agni, appeared in the sacrificial fire with a pudding plate. He addressed Dasharatha saying, "O King, the gods have sent me with this plate of pudding. Give it to your queens; after they consume it, they will bear four great sons."
The King gave half of the sacred pudding to his eldest queen, Kaushalya. He then divided the remaining half into two equal portions, offering one to Sumitra and the other to Kaikeyi. Since Kaikeyi received her share last, she voiced her displeasure to the King.
At that moment, as commanded by Lord Shiva, the eagle Garuda swooped down and snatched the pudding from Kaikeyi's hands. He delivered it into the open palms of the she-monkey Anjana, who was praying to Lord Shiva for a son. Anjana believed the pudding to be prasada from the Lord and consumed it. In due course, Anjana gave birth of Hanuman, who would later become a loyal servant of Lord Rama. Feeling sorry for Kaikeyi, who had lost her share, Kaushalya gave Kaikeyi some of her pudding and also gave Sumitra a second helping.
The queens soon gave birth to four divine boys. Kaushalya's son was named Rama, Kaikeyi's Bharata, and Sumitra's twins were named Lakshmana and Shatrughna. A lavish celebration was held at the palace.