Beijing and Delhi have agreed to end their stalemate in a disputed area claimed by China and Bhutan in the Himalayas, agreeing to an "expeditious disengagement" of troops. The deal follows two months of cage-rattling from both sides.

"In recent weeks, India and China have maintained diplomatic communication in respect of the incident at Doklam," India's foreign ministry announced Monday, referring to the disputed area claimed by both China and Bhutan.

"On this basis, expeditious disengagement of border personnel at the face-off site at Doklam has been agreed to and is on-going," the ministry said in a statement, as quoted by Reuters.

However, the agreement didn't come easy. In fact, it came after two months of boundary-pushing, patience-trying maneuvers.

India's roadblock

The tension between China and India began mid-June, when Bhutan came across Chinese troops attempting to extend a road through a plateau in the disputed Doklam territory.

The small country of Bhutan then turned to its more powerful ally, India, for assistance. Delhi responded by sending troops to the area – despite India having no claims to the territory.

The move prompted Beijing to accuse India of trespassing on Chinese soil and demanding the withdrawal of Indian troops before any negotiations could take place. India responded by saying both sides should withdraw their forces simultaneously.

Read more

'Don't cling to fantasies'

More than a month after the dispute began, China persisted that India back down.

“Don’t push your luck and cling to any fantasies,” Chinese defense ministry spokesman Senior Colonel Wu Qian said in a statement directed at Delhi.

He went on to warn that the People's Liberation Army (PLA) had strengthened its ability to defend China's "sovereignty and territorial integrity" through the years, and that its "determination has never wavered."

"It is easier to shake a mountain than to shake the PLA," Wu said.

A game of 'who blinks first'

It didn't take long for both sides to prove they had no desire of backing down, with India and China strengthening troop numbers. In an effort to push each other back, Chinese and Indian troops engaged in a process known as "jostling," where soldiers clashed, but without weapons.

Those not on the frontline also made their opinions clear, with officials from both countries defending their respective nations' positions and accusing the opposite side of adopting an aggressive stance.

READ MORE: China & India play ‘who blinks first’ over tiny strategic area in Himalayas

Some state media outlets in China called for India to be taught a new lesson, recalling the 1962 war between the two sides when the PLA staged live-fire drills in Tibet in an apparent demonstration of force.

Indian commentators, meanwhile, said Delhi's armed forces were capable of standing up to China.

Stones, rods & fists

Tensions between the two sides spilled over to another disputed area in the Himalayas earlier this month – one which actually involves a territorial disagreement between China and India.

Footage emerged showing a clash between Chinese and Indian border guards at the disputed Pangong Lake, which is located 4,300 meters above sea level and is cut by the 4,000 km Line of Actual Control (LAC) – the disputed border between the two countries.

The fight involved kicking, dragging, stone-throwing, and makeshift weapons.

The situation was eventually defused when both sides performed a 'banner drill,' a practice in which representatives from both sides held up their flags and declared ownership of the territory before retreating to their respective strongholds.

READ MORE: Stones, rods & fists: Chinese & Indian troops' border brawl caught on VIDEO

'7 Sins of India'

Chinese state news agency Xinhua contributed to the China-India standoff in its own way earlier this month, releasing a video mocking India over the disputed territory claimed by Beijing and Bhutan.

“When the whole world is trying to wake India up from its impulse, China’s realized it’s impossible to awaken a guy who is pretending to be asleep,” said the video's presenter, Dier Wang.

The footage then shows a Chinese person said to depict a "typical" representative of India's Sikh minority. The person is wearing a turban, sunglasses, and a very fake beard.

“Nobody’s blaming me because I am asleep,” the man says in English, in a poor attempt at an Indian accent.

The presenter goes on to ask viewers to consider the "seven sins" of India, including "trespassing" across the Chinese border and "violating international law."

The clip prompted a response from Indian newspaper The Hindustan Times, which accused the video of having "racist overtones that mocked and parodied Indians."

Many in the internet community called the video Chinese propaganda, with one person taking it as a chance to criticize Beijing for "claiming territories that don't belong to China" and having "the most polluted environment in the world."

READ MORE: ‘7 sins of India’: Chinese state media mock New Delhi over border row (VIDEO)

The decision to end the standoff – the most serious and prolonged between the two countries in decades – comes ahead of a summit of the BRICS nations which will begin in China Sunday. Indian Prime Minister Narendra Modi is scheduled to attend.