The disputed holy site of Ayodhya in northern India should be given to Hindus who want a temple built there, the country's Supreme Court has ruled.
The case, which has been bitterly contested for decades by Hindus and Muslims, centres on the ownership of the land in Uttar Pradesh state.
Muslims would get another plot of land to construct a mosque, the court said.
Many Hindus believe the site is the birthplace of one of their most revered deities, Lord Ram.
Muslims say they have worshipped there for generations.
At the centre of the row is the 16th Century Babri mosque that was demolished by Hindu mobs in 1992, sparking riots that killed nearly 2,000 people.
Hundreds of people were detained in Ayodhya on Friday ahead of the verdict, amid fears of violence.
Thousands of police personnel have also been deployed in the city, and shops and colleges have been shut until Monday.
Social media platforms are being monitored for inflammatory content, with police even replying to tweets and asking users to delete them.
Prime Minister Narendra Modi and other political leaders have appealed for calm.
What did the court say?
In the unanimous verdict, the court said that a report by the Archaeological Survey of India (ASI) provided evidence that the remains of a temple existed beneath the structure of the demolished Babri mosque.
It said that given all the evidence before it, the court had determined that the disputed land should be given to Hindus, while Muslims would be given land elsewhere to construct a mosque.
It then directed the federal government to set up a trust to manage and oversee the construction of the temple.