Muslims revere the compound in Ayodhya as the site of the now-demolished 16th century Babri Mosque, while Hindus say it is the birthplace of the god Rama.
The Allahabad High Court ruled that the site should be split, with the Muslim community getting control of one-third and two Hindu groups splitting the remainder, according to Ravi Shankar Prasad, a lawyer for one of the parties to the suit.
The Hindus will keep the area where a small tent-shrine to Rama has been erected, he said.
"The majority ruled that the location of the makeshift temple is the birthplace of Rama, and this spot cannot be shifted," he said.
The court also ruled that the current status of the site should continue for the next three months to allow for the land to be peacefully measured and divided, he said.