Just last year, Rahul Gandhi and the once-powerful party he led, the Indian National Congress, seemed to be on the ropes and little threat to Prime Minister Narendra Modi’s consolidation of political power.
Congress had not been a competitive factor in national elections in years, winning fewer and fewer votes each time Mr. Modi’s Bharatiya Janata Party was elected. And Mr. Gandhi himself had been convicted on a slander charge and barred from holding a seat in Parliament.
But on Tuesday, Mr. Gandhi and a broad opposition coalition led by his Congress party registered a far stronger showing than expected in India’s elections, setting the stage for an unlikely comeback.
“He has finally arrived,” said Rasheed Kidwai, a fellow at the Observer Research Foundation, a think tank in New Delhi. “This time he has improved his vote share by at least 17 million votes, which is very substantial.”
On Wednesday, Mr. Modi’s party announced that it had reached an agreement to form a governing coalition, including two parties that do not necessarily share its vision. Congress won 99 seats in the 543-seat Parliament, a gain of 47 seats, and the alliance of which it is the leading part won a total of 232.
Congress and its alliance of over two dozen political groups have presented the results as a “moral victory” over a B.J.P. government that they say was trying to change the country’s Constitution and have portrayed as anathema to India’s identity as a multifaith and secular country.
“The fight was to save the Constitution,” Mr. Gandhi, the son, grandson and great-grandson of Congress prime ministers, said as the results poured in.
The first major sign that Congress might be able to contend came in May 2023, just a couple of months after Mr. Gandhi’s conviction for slander, when his party won the state government of Karnataka, in the south of India, from the B.J.P.
The lift was temporary; Congress soon lost power in three states it governed to the B.J.P.
But at the same time, political experts say, Mr. Gandhi was pushing for changes within the party, India’s oldest, which had long resisted overhauling an archaic organizational structure that kept its top leaders isolated from the grass-roots workers who deliver votes.
Feelings that Congress’s leaders were corrupt and out of touch resulted in a string of defeats over a number of years and then degenerated into messy infighting within the party.
For the past two years, party members say, Mr. Gandhi has tried to reverse the decline of Congress by surrounding himself with young policy analysts to help him understand the challenges facing India, as well as party veterans with their ears to the ground in towns and villages that Congress was targeting. The party has in addition improved its social media game, trumpeting its messages on platforms like WhatsApp and YouTube.
Mr. Gandhi also raised his profile by embarking on two walks across India — meeting farmers in their fields and vegetable sellers on city streets; and drinking tea with recent graduates and gig workers — in an effort to show common cause with ordinary people.
Perhaps most important, Congress focused on a strategy of reaching out to and cooperating with key regional players across the country whose influence had dimmed under B.J.P. rule.
Congress leaders made a series of “seat-sharing” agreements with regional leaders, big and small, that strengthened the alliance against Mr. Modi’s party. To avoid splitting the anti-B.J.P. vote, Congress had its own candidates contest fewer seats. And Mr. Gandhi campaigned vigorously alongside the leaders of like-minded political groups across India.
Throughout the campaign, Mr. Gandhi also won support, party leaders say, by characterizing Mr. Modi as a leader who would destroy India’s secular character.
“It is a victory not just for him and our alliance partners but for the millions of poor Indians who voted to protect the secular fabric of this country,” said Srinivas B.V., another Congress leader, about Mr. Gandhi. “People showed Modi: ‘You are not God, and you can be replaced.’”
Since being voted to power in 2014, Mr. Modi has sought to position Hinduism, the religion of some 80 percent of Indians, at the center of the country’s official identity. He also promised to end corruption, overhaul the economy and help India become a “developed nation” by 2047. But after his re-election in 2019, he leaned into Hindu themes to a greater extent.
Mr. Gandhi’s efforts to contrast his vision for India with Mr. Modi’s largely paid off, analysts say, even if some members of his party jumped ship and sided with the B.J.P.
Many of the politicians who defected from Congress to the B.J.P. lost their seats, including in West Bengal and Maharashtra, where Congress and its partners did especially well.
Throughout the campaign Mr. Gandhi persistently linked Mr. Modi with Gautam Adani, Asia’s richest man, saying the prime minister was working for his tycoon friends, not for the vast majority of Indians who are poor. As if to vindicate this line of attack, over the two days after the election results were announced, the price of Mr. Adani’s flagship stock fell by 14 percent. (It then recovered somewhat on Wednesday.)
“People directly correlate Adani Ji with Modi Ji — directly,” Mr. Gandhi told reporters after the results, using Hindi honorifics for the two men.
Researchers who traveled across India during the voting said Mr. Gandhi had beaten Mr. Modi on his own turf in many places by focusing on issues like the millions of Indians without jobs and the economic difficulties faced by farmers. He also accused the B.J.P. of governance failures and worked with local political groups fighting for social justice and for the empowerment of lower-caste Indians.
Uttar Pradesh, where Mr. Modi made dozens of visits to campaign for local candidates, is one state where the changing fortunes of the two largest political groupings was evident.
The state is India’s largest, and accounts for 80 of the Parliament’s 543 seats. The B.J.P. recorded its worst performance there since 2009, in part because Mr. Gandhi was able to craft an alliance with a powerful local leader, Akhilesh Yadav.
In addition to the 37 seats picked up by Mr. Yadav’s Samajwadi Party, Congress won six, helped by aggressive campaigning by Mr. Gandhi’s sister, Priyanka Vadra, who helped defeat a former soap-opera actress who had served as a minister in Mr. Modi’s government. The B.J.P. won 33 seats, down from 62 in the previous Parliament.
The election results announced on Wednesday have given a major lift to hundreds of thousands of Congress workers across the country, who were growing tired of the internal infighting that has plagued their party for years.
Outside Congress headquarters in New Delhi, Bansi Lal Meena, a veteran Congress member from the state of Rajasthan, was exultant about his party’s performance.
“In villages and on the ground, the B.J.P. spread lies for years against us — saying that we are anti-Hindu,” he said. “They used my religion as a weapon against me to win votes.”
He added: “We will show them now because our people are also in Parliament.”