AYODHYA, INDIA -- Indian Prime Minister Narendra Modi on Monday opened a controversial Hindu temple built on the ruins of a historic mosque in the northern city of Ayodhya, in a political triumph for the populist leader who is seeking to transform the country from a secular democracy into a Hindu state.

The temple is dedicated to Hinduism's Lord Ram and fulfils a long-standing demand by millions of Hindus who worship the revered deity and extoll him for the virtues of truth, sacrifice and ethical governance. Modi's party and other Hindu nationalist groups who seized on the demand have portrayed the temple as central to their vision of reclaiming Hindu pride, which they say was suppressed by centuries of Mughal rule and British colonialism.

Modi and his governing Bharatiya Janata Party hope that opening the temple will help catapult the prime minister to a record third successive term in elections expected this spring. But with the temple still under construction, critics accuse Modi of a hurried opening to woo voters.

Modi, dressed in a traditional kurta tunic, led the opening ceremony as Hindu priests chanted hymns inside the temple's inner sanctum, where a 1.3-metre (4.3-foot) stone sculpture of Lord Ram was installed last week. A conch was blown by a priest to mark the temple's opening and Modi placed a lotus flower in front of the black stone idol, decked in intricate gold ornaments and holding a golden bow and arrow. He later prostrated before the idol.

Nearly 7,500 people, including elite industrialists, politicians and movie stars, witnessed the ritual on a giant screen outside the temple as a military helicopter showered flower petals.

“Our Lord Ram has arrived after centuries of wait,” Modi said in a speech after the ceremony, receiving a resounding applause from thousands of attendees. He said the temple was built after “countless sacrifices” and is a testament to a rising India “breaking the shackles of slave mentality.”

“Jan. 22, 2024, is not merely a date but marks the dawn of a new era,” Modi said.

Modi's government turned the event into a national occasion by organizing live screenings across the country and closing offices for half a day. Saffron flags - the colour of Hinduism - adorned the streets of various cities where government party workers had gone door to door handing out religious pamphlets.

Television news channels ran non-stop coverage of the event, portrayed as a religious spectacle. Some movie theatres broadcast the event live with complimentary popcorn. Many states declared the day a public holiday. In a rare step, stock and money markets were closed for the day.

“Ram Rajya (rule) begins,” a TV news headline said. Ram Rajya is a Sankrit phrase that means just and ethical governance in Hinduism but has also been used by Hindu nationalists to signify Hindu domination in an officially secular India.

Modi has been the face of an unprecedented and unapologetic fusion of religion and politics in India. Ahead of the temple opening, he set the tone by visiting numerous Ram temples over 11 days as part of a Hindu ritual.

Analysts and critics see Monday's ceremony as the start of the election campaign for Modi, an avowed Hindu nationalist and one of India's most consequential leaders. They say the pomp-filled display led by the government shows the extent to which the line between religion and state has eroded under Modi.

“Prime ministers prior to Modi have also been to temples, been to other places of worship, but they went there as devotees. This is the first time that he went there as somebody who performed the ritual,” said Nilanjan Mukhopadhyay, an expert in Hindu nationalism and author of a book on Modi.

The temple, located at one of India's most vexed religious sites, is expected to embolden Modi's chances of returning to power by drawing on the religious sentiments of Hindus, who make up 80% of India's population of 1.4 billion.

Ayodhya, once crowded with tightly packed houses and rundown stalls, has undergone an elaborate makeover in the lead up to the temple's inauguration. Narrow roads have been turned into a four-lane pilgrimage route leading to the temple, tourists are arriving at a new airport and sprawling railway station, and major hotel chains are building new properties.

Jubilant devotees from across the country have arrived to celebrate the opening, with groups of them dancing to religious songs that blare from speakers on roads bedecked with flowers. Huge cut-outs of Lord Ram and billboards of Modi are ubiquitous across Ayodhya, where the borders have been sealed to prevent more people from coming in. Some 20,000 security personnel and more than 10,000 security cameras have been deployed.

The moment will be remembered as momentous and historic by many of the country's Hindu citizens.

“I am here to see history unfolding before our eyes. For centuries, the story of Lord Ram has resonated in the hearts of millions,” said Harish Joshi who arrived in Ayodhya from Uttarakhand state four days before the ceremony.

Built at an estimated cost of $217 million and spread over nearly 3 hectares (7.4 acres), the temple lies atop the debris of the 16th-century Babri Mosque, which was razed to the ground in 1992 by Hindu mobs who believed it was built on temple ruins marking the birthplace of Lord Ram.

The site has long been a religious flashpoint for the two communities, with the demolition of the mosque triggering bloody riots across India that killed 2,000 people, mostly Muslims.

The dispute ended in 2019 when, in a controversial decision, India's Supreme Court called the mosque's destruction “an egregious violation” of the law but granted the site to Hindus while giving Muslims a different plot of land.

The fraught history is still an open wound for many Muslims, who have increasingly come under attack in recent years by Hindu nationalist groups and see the construction of the temple as a testament to Modi's Hindu-first politics.

Officials say the temple, a three-story structure made of pink sandstone, will open to the public after the ceremony and they expect 100,000 devotees to visit daily. Builders are still working to finish 46 elaborate doors and intricate wall carvings.

But not all are rejoicing. Four key Hindu religious authorities refused to attend, saying consecrating an unfinished temple goes against Hindu scriptures. Some top leaders from India's main opposition Congress party also boycotted the event, with many opposition lawmakers accusing Modi of exploiting the temple for political points.

Neighbouring Pakistan condemned the consecration, saying a temple built on the site of a demolished mosque would remain a blot on India's democracy.

“There is a growing list of mosques (in India) facing a similar threat of desecration and destruction,” Pakistan's Foreign Ministry said in a statement. It urged the international community to help save Islamic heritage sites in India from “extremist groups” and ensure that minority rights are protected.

At least three historical mosques in northern India are embroiled in court disputes over claims by Hindu nationalists who say they were built over temple ruins. Hindu nationalists have also filed cases in Indian courts seeking ownership of hundreds of historic mosques.

Saaliq and Pathi reported from New Delhi. Associated Press writer Riazat Butt in Islamabad, Pakistan, contributed to this report.