King Sagara was one the most powerful kings in the Ikshvaku dynasty of Suryavansha (the solar lineage).
Sagara was the son of Bahuka, born posthumously. As the story goes:
Bāhuka, the son of Vṛka, was greatly disturbed by his enemies, and therefore he left home with his wife and went to the forest.
When he died there, his wife wanted to accept the principles of satī, dying with her husband, but when she was about to die a sage named Aurva found that she was pregnant and forbade her to do so.
The co-wives of this wife of Bāhuka gave her poison with her food, but still her son was born with the poison. The son was therefore named Sagara (sa means “with,” and gara means “poison”).
Following the instructions of the great sage Aurva, King Sagara reformed many clans, including the Yavanas, Śakas, Haihayas and Barbaras.
The king did not kill them but reformed them. Srimad Bhagavata Purana narrates the story of this famous ruler of ancient India.
Then, again following the instructions of Aurva, King Sagara performed aśvamedha sacrifices, but the horse needed for such a sacrifice was stolen by Indra, the King of heaven.
King Sagara had two wives, named Sumati and Keśinī. It is said that he had sixty thousand children by his queen Sumati.
While searching for the horse, the sons of Sumati extensively dug up the surface of the earth and in this way dug a trench, which later became known as the Sāgara Ocean.
In the course of this search, they came upon the great personality Kapiladeva and thought Him to have stolen the horse.
With this offensive understanding, they attacked Him and were all burned to ashes.
Keśinī, the second wife of King Sagara, had a son named Asamañjasa, whose son Aṁśumān later searched for the horse and delivered his uncles.
Upon approaching Kapiladeva, Aṁśumān saw both the horse meant for sacrifice and a pile of ashes.
Aṁśumān offered prayers to Kapiladeva, who was very pleased by his prayers and who returned the horse.
After getting back the horse, however, Aṁśumān still stood before Kapiladeva, and Kapiladeva could understand that Aṁśumān was praying for the deliverance of his forefathers.
Thus Kapiladeva offered the instruction that they could be delivered by water from the Ganges. Aṁśumān then offered respectful obeisances to Kapiladeva, circumambulated Him, and left that place with the horse for sacrifice.
When King Sagara finished his yajña, he handed over the kingdom to Aṁśumān and, following the advice of Aurva, attained salvation.
Reference:Srimad-Bhagavatam Skadha 2