After months of worsening tensions on their contested Himalayan border, India and China surprised many by announcing that troops are to quickly disengage.
The joint announcement followed a marathon meeting between Indian Foreign Minister S Jaishankar and his Chinese counterpart Wang Yi in Moscow.
It came despite spiralling rhetoric between the nuclear-armed neighbours, which had suggested increasing hostility.
Earlier in the week, China's state-run Global Times had said Chinese troops would "quickly deal a heavy blow to Indian troops, and they will be all annihilated" if Delhi provoked a war.
India, too, had upped the ante, Defence Minister Rajnath Singh saying "there should be no doubt" about the country's resolve to protect its territorial integrity.
The statements reflected the reality on the ground: a hostile face-off between troops.
In June they fought a deadly clash in Ladakh's Galwan Valley with clubs and stones which left 20 Indian soldiers dead.
Both countries still have a huge deployment in the region where they have overlapping territorial claims - and overcoming their differences will not be easy.
'Ice breaker' envoy
So, what made the countries agree to de-escalate, when few expected it to happen?
Many observers, including Michael Kugelman, deputy director at the Wilson Center think-tank, believe that both countries were ready for a confrontation, but they also realised that a war, even a limited one, was not an option.
"It would have been catastrophic for both countries and the wider region. The economic stakes were too high to risk a war," he said.
The fact that Mr Jaishankar served as ambassador in Beijing for many years and is known to share good relations with Chinese diplomats appears to have helped.
It did break the ice, Mr Kugelman says, adding that personal relations often play a role in crucial diplomatic negotiations.
Weather, an unlikely factor, may have also played a role. The higher ridges of the Galwan Valley become inhospitable in winters.
Lieutenant General (retired) Vinod Bhatia, who served in the Indian army, says troops are used to operating in harsh conditions, but "given a chance, both armies would want to avoid that".
Reports also suggest that Indian troops recently occupied some ridges overlooking Chinese posts. Neither country has officially confirmed the reports.
"India may have used this advantage as a bargaining chip," Lt-Gen Bhatia adds.
Both countries also have many other crises to deal with. India's Covid-19 caseload continues to rise at an alarming rate and its economy is suffering. Any armed confrontation would affect the country's ability to overcome these issues.
China, meanwhile, has tensions with the US and a host of other countries to deal with, as well as global condemnation of its controversial security law in Hong Kong.
How soon could peace be restored?
Analysts say it's difficult to predict.
Yun Sun, director of the China Programme at the Stimson Center think-tank in Washington, says the joint declaration lacks details.
Firstly, it doesn't mention the Line of Actual Control (LAC) - the de facto boundary separating the countries.
"Several points along the LAC are contentious where troops are still stationed, so there is no clarity on the resolution of these issues," she says.
De-escalation takes time, says Lt-Gen Bhatia, and it will take longer in the current scenario.
"The area is too big and it will take time for commanders to come to an understanding. The military-level talks will happen when tensions are still high and emotions are raw," he says.
Both countries want to maintain the status quo. And that is tricky, says Ms Yun, because the two sides define the status quo differently.
"Chinese troops have gone deep into the territory India claims, and there is no clarity if they will vacate those positions."
What caused the escalation will also determine how quickly disengagement can happen. A major factor cited as a source of tension is a new road that connects Indian army stations in the region to a forward air base.
But Ms Yun believes the road can't be the only source because its construction took 20 years and "it wasn't a secret".
She believes many factors, including India's controversial decision to revoke a law that gave special status to the region and Washington's improving relations with Delhi, played a role.
"Beijing felt punishing India will give a warning to Delhi and Washington at the same time. But what they did not calculate was that India will refuse to back down," she says.
China has been in diplomatic confrontation with a number of countries since US officials accused it of not controlling the coronavirus outbreak effectively.
So, they became more aggressive, she says, adding that this was reflected in the statements of Beijing officials in recent days. Aggression has been a key factor in China's foreign policy - particularly in recent months. And Chinese state media often remind the country's neighbours of its superior military might.
This happened during the stand-off with India as well - but only in the past few days.
Officials in Delhi and Beijing were largely restrained in their comments in June and July, even after the Galwan clash that left the Indian soldiers dead.
Mr Kugleman says this was because they didn't want to undo PM Narendra Modi and Chinese President Xi Jinping's efforts in improving relations. The two have met 18 times since Mr Modi came to power in 2014.
"But it all came undone in recent days, and now it will be interesting to see how China and India sell the announcement to their people," he says.
Ms Yun says China will find it tricky to reverse the rhetoric because "it can't come across as weak or bullied by India".
Resolving these core issues, including unsettled disputes going back decades, along the LAC that stretches for 3,440km (2,100 miles), will not be resolved in a few days.
"So, it's a good start," Mr Kugleman says. "Talks are better than no talks, but we just have to be cautiously optimistic."