India and China have ended a three-week standoff on a windswept Himalayan plateau where they fought a war 50 years ago by agreeing to pull forces back to positions held before the confrontation, India's foreign ministry said on Monday.
The two countries packed up tents and left the disputed patch on the 5,000-metre-high (16,000-foot) Depsang Plain late on Sunday. But it had not been clear how far they had withdrawn.
Neither side has given details of the terms of the deal.
India says up to 50 Chinese soldiers intruded into its territory on the western rim of the Himalayas on April 15. Some officials and experts believe the incursion signalled Chinese concern about increased Indian military activity in the area.
Delhi had said the soldiers were 19 km (12 miles) beyond the point it understands to be the border with China in the Ladakh region of Kashmir, a vaguely defined de facto line called the Line of Actual Control, which neither side agrees on.
"The governments of India and China have agreed to restore status quo ante along the Line of Actual Control (LAC) in the Western Sector of the India-China boundary as it existed prior to 15 April, 2013." India's foreign ministry spokesman Syed Akbaruddin said in a statement.
He did not elaborate or say whether China's soldiers had already retreated the agreed distance, only saying that "flag meetings" between border commanders had been held "to work out the modalities and to confirm the arrangements".
On Sunday, an army officer from India's Northern Command told Reuters Indian troops had initially moved back 1 km, but that he did not know how far the Chinese had moved.
China's foreign ministry on Monday stopped short of saying the standoff had been resolved, but said the two countries had treated the situation from the perspective of their wider bilateral relations, which include important trade ties.
"Currently, based on my understanding, the friendly consultations between the relevant departments from both countries achieved positive progress," spokeswoman Hua Chunying told reporters at a daily press briefing.
Some experts and Indian officials say tensions are likely to persist as the area is highly strategic and abuts the Karakoram Highway joining Pakistan to China, which Beijing hopes to develop into a high-traffic trade route linking it to the Arabian Sea port of Gawadar.
Indian media, which had criticised the government's handling of the standoff, on Monday speculated that Delhi had agreed to Chinese demands that it dismantle some infrastructure in another disputed sector in order to defuse the standoff.
Akbaruddin said he could not give details of the deal.
Throughout the crisis, China denied it had crossed into Indian territory. Its soldiers displayed bright orange banners at the site which warned India's troops that they were in fact in Chinese territory, photos leaked by the Indian army showed.
The tensions had threatened to overshadow a visit by the Indian foreign minister to Beijing on May 9. China's Premier Li Keqiang is expected to visit India later this month.