Only the Yadavs and the Gandhis survived the Narendra Modi tsunami in Uttar Pradesh, where the Bharatiya Janata Party (BJP) won 71 of the 80 seats.
Its ally, Apna Dal, won in two constituencies, taking the tally of the alliance to 73.
Mayawati's Bahujan Samaj Party (BSP) failed to win even a single seat. It stood second in 34 constituencies.
Congress president Sonia Gandhi (Rae Bareli) and her son Rahul Gandhi (Amethi) were the only Congress candidates who could register victories.
Sonia won by 352,713 votes, while Congress vice-president Rahul defeated BJP candidate Smriti Irani by 107,903 votes to overcome the initial jitters.
Prominent Congress leaders who were defeated include PL Punia (Barabanki), Raj Babbar (Ghaziabad), Sriprakash Jaiswal (Kanpur) and Rita Bahuguna Joshi (Lucknow).
The ruling Samajwadi Party (SP) won just five seats. SP chief Mulayam Singh Yadav was in the fray from family pocket borough Mainpuri and Azamgarh in eastern UP.
His victory margin in Mainpuri was 364,666 votes, while he won in Azamgarh by 63,204 votes.
Mulayam's decision to fight from Azamgarh, a constituency with heavy Muslim-Yadav population, was seen as his bid to consolidate both the sections.
Given his thin victory margin in Azamgarh, Mulayam may retain the eastern UP seat and vacate Mainpuri, which would be easier to win.
Dimple Yadav, wife of Mulayam's son and UP chief minister Akhilesh Yadav, won in Kannauj.
Mulayam's nephews Akshay Yadav, son of Rajya Sabha member Ramgopal Yadav, and Dharmendra Yadav won in Firozabad and Badaun, respectively.