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.
The complex history of India's Ayodhya holy site
At the centre of the row is the 16th Century Babri mosque which was demolished by Hindu mobs in 1992, sparking riots that killed nearly 2,000 people.
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.
The court said that, given all the evidence presented, it had determined that the disputed land should be given to Hindus for a temple to Lord Ram, 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.
However, the court added that the demolition of the Babri mosque was against the rule of law.
What has the reaction to the verdict been?
Despite warnings by authorities not to celebrate the verdict, BBC correspondents in court say they heard chants of "Jai Shree Ram" (Hail Lord Ram) outside as the judgement was pronounced.
"It's a very balanced judgement and it is a victory for people of India," a lawyer for one of the Hindu parties told reporters soon after.
However, a representative for the Muslim litigants said that they were not satisfied and would decide whether to ask for a review after they had read the whole judgement.
Outside the court, the situation has been largely calm.
Hundreds of people were detained in Ayodhya on Friday ahead of the verdict, amid fears of violence.
Thousands of police officers have also been deployed in the city, while 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 is the row actually about?
Many Hindus believe the Babri Masjid was actually constructed on the ruins of a Hindu temple that was demolished by Muslim invaders in the 16th Century.
Muslims say they offered prayers at the mosque until December 1949 when some Hindus placed an idol of Ram in the mosque and began to worship the idols.
The two religious groups have gone to court many times over who should control the site.
Since then, there have been calls to build a temple on the spot where the mosque once stood.
Hinduism is India's majority religion and is thought to be more than 4,000 years old. India's first Islamic dynasty was established in the early 13th Century.