Rahul Gandhi, the political scion of India’s most powerful ruling dynasty, has announced his resignation as president of India’s opposition Congress party in the wake of a catastrophic defeat in national elections in May.

In a tweet on Wednesday, Gandhi said he accepted responsibility for his party’s electoral failure against the governing Hindu nationalist Bharatiya Janata party of the prime minister, Narendra Modi. “As president of the Congress party I am responsible for the loss of the 2019 election. It is for this reason that I have resigned as Congress president.”

Modi’s BJP party won a landslide 300 seats, making huge unexpected gains in traditionally Congress territory.

Gandhi, who failed even to secure his own seat in the Congress stronghold of Amethi in Uttar Pradesh, had submitted an internal resignation to the party after the election results came out on 23 May, but was asked by the party’s top brass to remain in his position as Congress president.

His resignation, if accepted, will pose an existential question for a party that led India’s struggle for independence from British colonial rule about whether Congress can unify around a common agenda and set of values instead of descendants of a single dynasty.

Gandhi belongs to a family that has controlled the party since India’s independence. His great-grandfather Jawaharlal Nehru was India’s first prime minister, his grandmother Indira Gandhi was India’s prime minister for a decade from 1966 to 1977 and then again from 1980 until her assassination in 1984, and his father, Rajiv Gandhi, was prime minister from 1984 to 1989.

But despite its gilded legacy the Congress party’s modern image has become associated with corruption scandals, broken promises and a lack of vision.

During the election campaign, India’s incumbent prime minister, Modi, targeted his criticism of the Congress party directly at Gandhi, the baby-faced Oxford-educated heir whose position as party president seemed to critics to be inherited, not earned.

Gandhi’s media appearances and political gaffes compounded the image that Modi painted of a man unqualified to govern India, the world’s most populous democracy. Meanwhile, Modi’s own rise to India’s highest office despite his humble origins as a railway station tea server resonated with millions of Indians, as the country experiences rapid economic transformation.

In his resignation statement, Gandhi said he was not going to nominate the party’s next president. Instead, he urged his party’s working committee to nominate its next leader and to “radically transform itself”.

Gandhi used his parting statement to deliver searing criticism of Modi’s BJP. He wrote: “We didn’t fight a political party in the 2019 election. Rather, we fought the entire machinery of the Indian state, every institution which was marshalled against the opposition. It is now crystal clear that our once cherished institutional neutrality no longer exists in India.”