To keep Yadav out of power in Uttar Pradesh, the BJP and BSP formed an alliance, and Dalit leader Mayawati became the chief minister. However, due to political differences, BJP withdrew support from Mayawati, and the state went into elections again. In the following elections, Muyalam Singh's SP won, and he assumed office as the chief minister for the third time.
His third term as CM coincided with the Lok Sabha election of 2004. SP performed exceptionally well in those elections, winning 37 seats in Uttar Pradesh. However, Congress was able to form the government with the support of communist parties, and the SP was not included in the government despite announcing unilateral support for it.