As per Uttara Ramayana, Indra was once captured and kept in a prison in Lanka for a year by Ravana. The story begins with Meghananda, son of Ravana, defeating Indra and capturing him.
After a fierce battle, Indra was defeated by Meghanada. He took Indra to Lanka as a prisoner. Ravana chained Indra's hands and feet and tied him to his flagstaff. Later he was put in prison.
Devas, celestial beings, approached Brahma and asked his help for releasing Indra. Brahma went to Lanka and secured the release of Indra. Brahma also gave Meghananda the title Indrajit – one who had victory over Indra.
Indra had committed adultery with Ahalya, Sage Gautama's wife. The sage had then cursed Indra that he would spend a year in prison, chained by an enemy. His life in Ravana's prison in Lanka was due to this curse.