In Hinduism the birthplace of the deity Rama, known as "Ram Janmabhoomi", is considered a holy site. This site is often believed to be at the place where the Babri Masjid stood in the city of Ayodhya in Uttar Pradesh: historical evidence to support this belief is scarce. In 1528, following the Mughal conquest of the region, a mosque was built at the site by the Mughal general Mir Baqi, and named the "Babri Masjid" after the Mughal emperor Babur. Popular belief holds that Baqi demolished a temple of Rama to build the mosque: limited historical evidence exists to support this theory. Archaeological evidence has been found of a structure pre-dating the mosque. This structure has been variously identified as a Hindu temple and a Buddhist structure.
For at least four centuries, the site was used for religious purposes by both Hindus and Muslims. The claim that the mosque stood on the site of a temple was first made in 1822, by an official of the Faizabad court. The Nirmohi Akhara sect cited this statement in laying claim to the site in later in the 19th century, leading to the first recorded incidents of religious violence at the site, between 1853 and 1855. In 1859 the British colonial administration set up a railing to separate the outer courtyard of the mosque to avoid disputes. The status quo remained in place until 1949, when idols of Rama were surreptitiously placed inside the mosque, allegedly by volunteers of the Hindu Mahasabha. This led to an uproar, with both parties filing civil suits laying claim to the land. The placement of the idol was seen as a desecration by the users of the Masjid. The site was declared to be in dispute, and the gates to the Masjid were locked.
In the 1980s, the Vishva Hindu Parishad (VHP) began a campaign for the construction of a temple dedicated to Rama at the site, with the Bharatiya Janata Party (BJP) as its political voice. The movement was bolstered by the decision of a district judge, who ruled in 1986 that the gates would be reopened and Hindus permitted to worship there. This decision was endorsed by Indian National Congress politician Rajiv Gandhi, then the Prime Minister of India, who sought to regain support from Hindus he had lost over the Shah Bano controversy. Nonetheless, the Congress lost the 1989 general election, and the BJP's strength in parliament grew from 2 members to 88, making its support crucial to the new government of V. P. Singh.
In September 1990, BJP leader L. K. Advani began a Rath Yatra, a political rally travelling across much of north India to Ayodhya. The yatra sought to generate support for the proposed temple, and also sought to unite Hindu votes by mobilizing anti-Muslim sentiment. Advani was arrested by the government of Bihar before he could reach Ayodhya. Despite this, a large body of kar sevaks or Sangh Parivar activists reached Ayodhya and attempted to attack the mosque. This resulted in a pitched battle with the paramilitary forces that ended with the death of several kar sevaks. The BJP withdrew its support to the V. P. Singh ministry, necessitating fresh elections. The BJP substantially increased its tally in the union parliament, as well as winning a majority in the Uttar Pradesh assembly.