For background, there was a popular protest happening in Bihar called the Sampoorna Kranti movement, led by veteran Gandhian, Jayaprakash Narayan. Indira Gandhi did not support the movement and had claimed that the movement was being funded by foreign donations and moneyed interests.
On being found guilty of using state machinery for electoral purposes in 1975, Indira Gandhi declared a state of emergency. Political opponents were detained and jailed. Elections were suspended, the press was censored. Sanjay Gandhi took hold of a number of authoritarian policies, like forced sterilization.
Eventually, the emergency was lifted after 2 years, in 1977.
A general election followed where Congress lost by record numbers. Indira lost her seat of Rae Bareilly, while Sanjay was defeated in Amethi.