Narendra Modi has been sworn in as prime minister of India for a historic third term, ushering in a new era of coalition politics for India’s strongman leader.

The ceremony, which took place at the presidential palace on Sunday evening, marked Modi’s return to power, only the second leader in India’s history to win three consecutive terms.

A beaming Modi stood next to two Bharatiya Janata party (BJP) heavyweights, Rajnath Singh and Amit Shah, who were both confirmed to return as cabinet ministers. As he stepped up to the podium to make his pledge to the president, Droupadi Murmu, loud cheers erupted from the vast crowds gathered to watch the ceremony.

Modi’s third term is likely to take a very different shape from his previous decade in office after his BJP faced an unexpectedly challenging election. The party won the most seats in the polls, which took place over almost two months with the results finally announced on Tuesday, but fell short of an absolute majority.

Modi had to rely on coalition partners, notably smaller regional parties, to give the BJP enough seats to claim a parliamentary majority and form the government. It is the first time that Modi, who is used to leading from the front, has been forced to govern in a power-sharing arrangement, with coalition partners taking several cabinet and ministerial posts.

Analysts believe the BJP’s new dependence on secular coalition parties could present a challenge for Modi and may curtail some of the more authoritarian and dictatorial tendencies of his government in the past, in particular his pursuit of Hindu-first policies.

Since he came to power in 2014, Modi has reshaped the secular country with an aggressive Hindu nationalist agenda, gaining widespread support among India’s 80% Hindu majority. His supporters credit him with India’s economic growth and elevated standing on the world stage, but he lost swathes of votes in the election because of issues such as chronic unemployment and fears over India’s democracy.

Modi arrives to take the oath, walking past senior members of his BJP party. Photograph: Rajat Gupta/EPA

Speaking to his coalition parties over the weekend, Modi pushed back at the opposition alliance who have claimed that the election was a defeat for the prime minister. “We did not lose,” he said but also struck an unusually conciliatory note, adding: “To run the government, a majority is necessary. But to run the nation, a consensus is necessary.”

The opposition alliance, which goes by the acronym INDIA, performed far better than polls had predicted in the election, and will be returning to parliament with more than 230 seats, more than double the previous election.

Heads of state from neighbouring countries, including the prime minister of Bangladesh, Sheikh Hasina, and the Sri Lankan president, Ranil Wickremesinghe, flew in to attend Modi’s swearing in ceremony. Also in attendance were two of India’s richest industrialists, Gautam Adani and Mukesh Ambani, who are seen to enjoy a close relationship with Modi, and the Bollywood superstar Shah Rukh Khan.

Mallikarjun Kharge, the president of the Congress party, attended the ceremony as a representative for the INDIA opposition alliance, but all other opposition leaders snubbed it.

Mamata Banerjee, the head of the opposition Trinamool Congress party, said she would not be attending as the government was being formed “illegally and undemocratically”, adding that governments “sometimes last only for a day”.

This article was amended on 9 June 2024. Ranil Wickremesinghe is Sri Lanka’s president not prime minister as an earlier version said.