India and China have agreed to an "expeditious disengagement" of troops in a disputed border area where their soldiers have been locked in a stand-off for more than two months, India's foreign ministry said on Monday.
The decision comes ahead of a summit of the BRICS nations - a grouping that also includes Brazil, Russia and South Africa - in China next month, which Indian Prime Minister Narendra Modi is expected to attend.
Indian and Chinese 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.
The Indian ministry said the two sides had agreed to defuse the crisis following diplomatic talks.
"In recent weeks, India and China have maintained diplomatic communication in respect of the incident at Doklam," the ministry said in a statement.
"On this basis, expeditious disengagement of border personnel at the face-off site at Doklam has been agreed to and is on-going," it said in a statement.
It did not offer more details of the terms of disengagement from the area which had raised fears of a wider conflict between the Asian giants who fought a brief border war in 1962.
China said Indian troops had withdrawn from the remote area in the eastern Himalayas. Chinese foreign ministry spokeswoman Hua Chunying 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.
India and China have been unable to settle their 3,500km frontier and large parts of territory are claimed by both sides.
"China hopes India respects the historical boundary and works with China to protect peace along the border on the basis of mutual respect of each other's sovereignty," Hua added.
The trouble started in June when India sent troops to stop China building a road in the Doklam area, which is remote, uninhabited territory claimed by both China and Bhutan.
India said it sent its troops because Chinese military activity there was a threat to the security of its own northeast region.
But China has said India had no role to play in the area and insisted it withdraw unilaterally or face the prospect of an escalation. Chinese state media had warned India of a fate worse than its crushing defeat in the war in 1962.