Narendra Modi has won a dramatic second landslide election, returning him for another five-year term as prime minister of India, giving a convincing mandate to his Hindu nationalist Bharatiya Janata Party (BJP).

With the count nearing completion, the BJP was on course to win 302 of the 542 seats up for grabs, a significant improvement on its 282 tally from the last election in 2014. Pre-election surveys and most exit polls had predicted the ruling party would win again but with a reduced majority.

Rahul Gandhi, leader of the main opposition Congress party, which is expected to win fewer than 60 seats, conceded defeat at a news conference on Thursday evening.

“The people of India have decided that Narendra Modi is going to be prime minister, and as an Indian I fully respect that,” Mr Gandhi said. “I wish him all the best, and hopefully he will look after the interests of this country.”

There was a festival atmosphere at the BJP headquarters in Delhi, where the party encouraged thousands of supporters to gather and celebrate the result.

Indian General Election 2019 Show all 10 1 /10 Indian General Election 2019 Indian General Election 2019 Bharatiya Janata Party (BJP) President Amit Shah (R) welcomes Indian Prime Minister Narendra Modi (L) at BJP headquarters prior to a ceremony to thank the Union council of Ministers for their contribution in India's general election, in New Delhi on May 21, 2019 AFP/Getty Indian General Election 2019 An Indian Bharatiya Janata Party (BJP) supporter shouts slogans and holds the party flag as he celebrates on the vote results day for India's general election in New Delhi on May 23, 2019. - Prime Minister Narendra Modi looked on course on May 23 for a major victory in India's election, with early trends from the election commission showing a clear lead for his party. AFP/Getty Images Indian General Election 2019 Indian election officials count votes using electronic voting machines at a counting center for the Lok Sabha (lower house of Parliament) election, in Jammu, the winter capital of Kashmir, India, 23 May 2019. The parliamentary elections, which began on 11 April 2019, were held in seven phases throughout India and are currently being tabulated. The Lok Sabha elections were held for 542 of the 543 Lok Sabha seats, and a party or alliance needs 272 seats to form a government. EPA Indian General Election 2019 Indian supporters of Bharatiya Janata Party (BJP) dance as they celebrate on the vote results day for India's general election in Siliguri on May 23, 2019. - Prime Minister Narendra Modi looked on course on May 23 for a major victory in India's election, with early trends from the election commission showing a clear lead for his party. AFP/Getty Images Indian General Election 2019 Indian supporters and party workers of Bharatiya Janata Party (BJP) dance as they celebrate on the vote results day for India's general election in Bangalore on May 23, 2019. - Indian Prime Minister Narendra Modi looked on course on May 23 for a major victory in the world's biggest election, with early trends suggesting his Hindu nationalist party will win a bigger majority even than 2014. AFP/Getty Images Indian General Election 2019 Indian supporters and party workers of Bharatiya Janata Party (BJP) dance and hold flags as they celebrate on the vote results day for India's general election in Bangalore on May 23, 2019. - Indian Prime Minister Narendra Modi looked on course on May 23 for a major victory in the world's biggest election, with early trends suggesting his Hindu nationalist party will win a bigger majority even than 2014. AFP/Getty Images Indian General Election 2019 An Indian member of the Dravida Munnetra Kazhagam (DMK) shouts slogans and shows portraits of party president M.K. Stalin as she celebrates on the vote results day for India's general election in Chennai on May 23, 2019. - Indian Prime Minister Narendra Modi looked on course on May 23 for a major victory in the world's biggest election, with early trends suggesting his Hindu nationalist party will win a bigger majority even than 2014. AFP/Getty Images Indian General Election 2019 Bharatiya Janata Party (BJP) supporters, wearing masks dipicting Indian Prime Minister Narendra Modi, celebrate BJP's potential win in the the Lok Sabha election the Lok Sabha elections, in Amritsar, India, 23 May 2019. The Lok Sabha, the lower house of Parliament, elections, which began on 11 April 2019, is having the results tallied today. The Lok Sabha elections were held for 542 of the 543 lower house seats, and a party or alliance needs 272 seats to form a government. According to initial polling Narendra Modi could retain the position of Prime Minister along with the Bhartya Janta Party. EPA Indian General Election 2019 A Bharatiya Janata Party (BJP) supporter wears a mask dipicting Indian Prime Minister Narendra Modi as he celebrates BJP's potential win in the the Lok Sabha election the Lok Sabha elections, in Amritsar, India, 23 May 2019. The Lok Sabha, the lower house of Parliament, elections, which began on 11 April 2019, is having the results tallied today. The Lok Sabha elections were held for 542 of the 543 lower house seats, and a party or alliance needs 272 seats to form a government. According to initial polling Narendra Modi could retain the position of Prime Minister along with the Bhartya Janta Party EPA Indian General Election 2019 Bharatiya Janata Party (BJP) supporters celebrate in their party's Assam state office in Gauhati, India, Thursday, May 23, 2019. Indian Prime Minister Narendra Modi and his party have a commanding lead in early vote counting from the country's six-week general election. AP

People dressed in white, green and most importantly the saffron of the BJP thronged the streets for more than a kilometre leading up to the party headquarters, where security was heightened ahead of Mr Modi’s appearance.

Addressing thousands of party workers celebrating the outcome, he urged the world to “recognise India’s democratic power”, and attributed the party’s showing to his pro-poor policies, including free medical insurance and relief for distressed farmers.

“India wins yet again,” he tweeted.

Arriving party leaders were met like rock stars and there was a minor stampede upon the sight of BJP president Amit Shah, with the swell of the crowd sending some supporters tumbling. Sporadic chants of “Modi, Modi” broke out frequently and a wedding band kept up the frenzied feel of the courtyard outside.

“This win was 100 per cent Modi,” said Delhi-based BJP party worker Pinkesh Rana, 41. While few analysts predicted the margin of victory – with its allies in the right-wing NDA coalition, the BJP looks set to command 350 of the 542 seats in the Lok Sabha lower house – Ms Rana and other party workers said they did not see the result as a shock.

“The scale of the victory is not a surprise for us, we knew it would be like this because we know how hard Narendra Modi has been working for the country. And unlike any other leader, he connected with the people.”

With India’s farmers struggling, its economy slowing and leaked jobs figures showing unemployment at its highest level in decades, Congress and powerful regional opposition parties fought a campaign based on highlighting the failures of the incumbent government.

That approach appears to have failed. The BJP has instead succeeded in making the election all about Modi – from affluent communities in the capital to the poorest state of Bihar, voters told The Independent they were supporting the BJP because of his leadership.

The BJP has now secured back-to-back outright majorities in parliament for the first time since 1984. The scale of the victory was “absolutely stunning”, said commentator Arti Jerath. “Modi is the predominant leader in India today. He has pushed everybody else aside. Nobody in the opposition is a match for him.”

The Modi factor has made even the most unthinkable constituency results a reality – Mr Gandhi, as he conceded the national vote, also admitted defeat in the Amethi seat in Uttar Pradesh that his family has held for generations. He will remain an MP, however, as he looks to have won another contest in Wayanad, Kerala.

In Bhopal, admittedly a BJP stronghold, a candidate for the party facing active terror charges looks to have won herself a seat as an MP. Pragya Singh Thakur is accused of involvement in the 2008 Malegaon bombings by suspected right-wing Hindu terrorists, and only last week described the assassin of Mahatma Gandhi as a “patriot”. As of Thursday evening, she was winning her seat by a margin of around 200,000 votes.

The most surprising regional result of the election came in West Bengal, a state which saw the worst of the violent clashes during the mammoth six-week polls as party workers and police came to blows.

There the BJP took 19 of 42 available seats, making huge inroads into a state dominated by local parties and where it has never had much of a presence. At one point it looked like it might even take a majority in the state.

Even where it lost seats, the BJP exceeded expectations. In Uttar Pradesh, the bellwether state with the most seats in parliament, it was thought likely that a powerful alliance of opposition parties might defeat Mr Modi’s outfit, which took 71 of 80 seats in 2014. Instead, the BJP was on course to hold almost 60.

Independent Minds Events: get involved in the news agenda

Party supporters now want Mr Modi to use his clear second-term mandate to deliver further controversial pro-Hindu measures, including the building of a temple to Lord Ram at the site in Ayodhya where a mosque was pulled down by Hindu extremists in 1992.

Mr Modi utilised a deteriorating relationship with Pakistan since the turn of the year to push national security as the BJP’s number one election issue, while Kashmiri Muslims across India faced a backlash from their Hindu neighbours.

Nonetheless, Pakistan’s Imran Khan was among the first world leaders to congratulate Mr Modi on his victory, writing on Twitter that he was “look[ing] forward to working with him for peace, progress and prosperity in South Asia”.

Final results will not be confirmed until Friday, but congratulations for the BJP came too from Chinese president Xi Jinping, Israeli prime minister Benjamin Netanyahu, Russia’s president Vladimir Putin and Sri Lankan president Maithripala Sirisena.

While a BJP spokesman said the result was a “stamp of approval” from ordinary Indians for Mr Modi’s leadership, the post mortem began for Congress, India’s oldest party and one which has led the country for the majority of the years since it won independence from Britain in 1947.

In contrast to the flares, firecrackers and huge crowds at BJP headquarters, the Congress party office in Delhi was deserted on Thursday apart from a brief flurry of activity for Mr Gandhi’s news conference.

Beyond its failure to dent public confidence in Mr Modi himself, Congress suffered from having a party infrastructure that was outmanoeuvred and outgunned by the formidable BJP machine on the ground.

The BJP outspent Congress by six times on Facebook and Google advertising, data showed, and by as much as 20 times overall, according to the Reuters news agency.

But the real breakthrough was on WhatsApp, which has more than 200 million users in India and where the BJP set up hundreds of thousands of localised chats to disseminate its messaging.

Meanwhile, Congress failed to innovate. “The party has not been able to improve at all,” on the 44 seats it won in 2014, a historic low, said Rahul Verma, a fellow at the centre for Policy Research in Delhi.