India and China have agreed on an "expeditious disengagement" of troops at a disputed border area in the Himalayas, where their soldiers have been locked in a standoff for more than two months, according to India's foreign ministry.
The decision comes in the run-up to a summit of the BRICS nations - a grouping that also includes Brazil, Russia and South Africa - in China early next month, which Narendra Modi, India's prime minister, is expected to attend.
"In recent weeks, India and China have maintained diplomatic communication in respect of the incident at Doklam," India's ministry of foreign affairs said on Monday, referring to the area in the Himalayas close to the borders of China, India and Bhutan.
"On this basis, expeditious disengagement of border personnel at the face-off site at Doklam has been agreed to and is ongoing."
China said Indian troops had withdrawn from the remote area in the eastern Himalayas. Hua Chunying, Chinese foreign ministry spokesperson, said Chinese troops would continue to patrol the Doklam region.
"China will continue to exercise sovereignty rights to protect territorial sovereignty in accordance with the rules of the historical boundary," she said.
Speaking from China's capital, Beijing, Al Jazeera's Adrian Brown said that the "high-stakes, high-altitude problem" was over for now.
"This dispute has been going on for 55 years but China is making it clear that it is not giving up its historical claims," he said. "It says it wants to work with India to maintain peace but it said India must respect China's historical borders."
Chinese and Indian troops have been confronting each other at the Doklam plateau near the borders of India, its ally Bhutan, and China, in the most serious and prolonged standoff in decades along their disputed Himalayan border.
India says the dispute erupted after India objected to the Chinese building a road through the mountainous area.
India said it sent its troops because Chinese military activity there was a threat to the security of its own northeast region.
Small incursions and troop standoffs are common along other parts of the contested 3,500km frontier, but the recent impasse was marked by its length and the failure of talks to resolve the dispute, raising fears of a wider escalation as the two Asian giants compete for influence.
The Nathu La Pass, on the frontier between the Indian state of Sikkim and Chinese-controlled Tibet, was the site of a fierce border clash between Chinese and Indian troops in 1962.
Shekhar Gupta, Indian political commentator, said there was too much at stake for the two countries to fight over a small piece of territory.
"Hopefully, Doklam is a new chapter in India-China relations. Too much at stake for both big powers to let legacy real-estate issues linger," he said in a Twitter post.