With the release of the Indian pilot captured by Pakistan, tensions between the two nuclear-armed countries over the attack in Kashmir are expected to abate. So who won the battle of perception during the crisis?
On Thursday afternoon Pakistani Prime Minister Imran Khan announced in parliament that Pakistan would release the captured Indian pilot as a "peace gesture".
In Delhi, Indian Prime Minister Narendra Modi, was addressing a meeting of scientists. Moments after Mr Khan's remarks, he responded with a sarcastic broadside against Pakistan, saying that a "pilot project had been completed" and "now we have to make it real". While his supporters cheered, others found the remark cocky and tasteless.
On Tuesday, hours after Indian fighter jets entered Pakistani territory and bombed an alleged terrorist training camp, Mr Modi had opened a packed campaign rally - crucial general elections are barely a month away - with a bravado-laced flourish. "I want to assure you that the country is in safe hands," he told the meeting, to deafening applause.
Less than 24 hours later, Pakistan struck back, shooting down an Indian fighter jet in Pakistan-administered Kashmir and capturing pilot Abhinandan Varthaman.
While both sides were under immense pressure to calm tensions, Mr Khan reached out and offered to release the pilot. Former Indian diplomat and strategic affairs expert KC Singh remarked that hawks in Mr Modi's BJP and the Indian establishment "will be stranded by Imran Khan's diplomatic reverse swing". (A reverse swing in cricket is the art of swinging the ball when it turns in towards the batsman rather than moving away from him. Mr Khan was one of the world's finest cricketers in his sporting days.)
Since he swept to power in 2014, Mr Modi has retained a vice-like grip over the narrative. Helping him is a largely obsequious local media, which faithfully boosts his image of a muscular nationalist. So, many wondered why Mr Modi had chosen his bureaucrats and military to do the talking to the media and not addressed the people himself at a time when the country was on a knife-edge and awash with rumours of an imminent war with a nuclear-armed neighbour.
Among those miffed were India's main opposition parties. Twenty-one of them criticised Mr Modi for continuing to attend election meetings and political events and even launch a mobile app during, what was arguably, the biggest security crisis of his tenure.
Many believe that Pakistan had blindsided Mr Modi with a quick and brazen retaliatory attack in which it brought down an Indian fighter jet and captured the pilot. Over the next two days Mr Khan called for de-escalation of hostilities, talked about peace and announced that the pilot would be freed. KC Singh says the Pakistani prime minister portrayed a picture of "dignified moderation and readiness to settle differences through talks" and took everyone by surprise with his decision to send back the Indian pilot.
Mr Khan spoke to his people and defence officials kept the media updated regularly. The prime minister, many analysts in India say, came across looking as a "reasonable leader" by not trying to corner India, and allowing an exit route for cessation of hostilities.
Mr Modi appeared to lose control of the narrative. "Any which way you spin it, Pakistan's attack took India by surprise," says Srinath Raghavan, historian and author, most recently of Fierce Enigmas: A History of the United States in South Asia.
Consider this. India struck Pakistan in the middle of the night in what was a retaliatory action for the attack in Pulwama on 14 February in which more than 40 Indian troops were killed. Pakistan's response was swift and audacious, striking India in broad daylight the next day.
Timeline of the India-Pakistan escalation
- 14 to 15 February: A suicide bomber kills at least 40 paramilitary police in Pulwama, in Indian-administered Kashmir, which is then claimed by Pakistan-based militant group Jaish-e-Mohammad. Pakistan denies any role in the attack, but India vows to "completely isolate" the country from the rest of the world.
- 18 February: A gun battle breaks out as Indian troops search for militants in Kashmir, and nine people die. Meanwhile, Kashmiris living across India are threatened and, in some cases, reportedly attacked.
- 19 February: Pakistan warns India against attacking as tensions between the two countries increase.
- 26 February: India launches air strikes in Balakot, which is in Pakistani territory. These are the first strikes launched across the Line of Control (LoC) since a war between the two nations in 1971. India says the strikes were targeting a militant camp nearby, but Pakistan disputes this claim.
- 27 February: Pakistan says it shot down two Indian military jets and captured an Indian pilot, Abhinandan Varthaman. Pakistan's information ministry publishes - and then deletes - a video showing Mr Varthaman blindfolded and with blood on his face.
- 1 March: Pakistan returns the captured Indian pilot, and he's greeted by cheering crowds on the Indian side of the border. People in Horran, the Pakistan-controlled village where the plane was downed, claim that he opened fire before his aircraft was shot down.
'Revenge is not a strategy'
The capture of the pilot meant that the narrative and expectations of Mr Modi and his government were thrown off kilter and the upbeat narrative of the morning before had now completely changed to bringing the pilot home. The Indian military briefing came more than 30 hours after the Pakistani attack. Mr Modi and his government had clearly little headroom to control the narrative.
In the end, trying to control the narrative through bravado can easily backfire. Mr Modi is not the first prime minister to face a security situation provoked by Pakistan-based terror groups: his predecessors Atal Behari Vajpayee and Manmohan Singh faced similar provocations from across the border and had similar capabilities to strike back, but took calculated decisions to lower the temperature. "Revenge cannot be a strategic objective. Any strategy driven by emotions is likely to fail," says Mr Raghavan.
Large parts of the press at home have spun the freeing of the Indian pilot as Mr Modi's victory. Very few people are asking questions about the massive intelligence failure that led to the attack in Pulwama, and how Pakistan could penetrate air defences in broad daylight.
India's military has not even achieved its strategic aim to establish a new normal in which it would deter Pakistan-backed terrorism in India with the threat of automatic military strikes, says Ajai Shukla, a leading defence analyst.
"So far, Pakistan has demonstrated it can match India, and this requires the Indian military to escalate the punishment to a level that Pakistan cannot match. However, decades of neglect and under-funding have hollowed out India's military to the point where Mr Modi cannot rely on its capability to punish Pakistan swiftly and relatively bloodlessly," he says.
Also details of the extent of damage inflicted on the alleged terrorist camp in Pakistan by the Indian jets is still unclear. Indian authorities are not clear how many people died in the raid, although sections of the media have freely reported some 300 militants had been killed. By all accounts, Mr Modi should be staring at hard questions and fearing that he's lost the narrative.
But it may not be so. Many believe Mr Khan may have won the battle of perception with his domestic constituency and some Indians at home, but Mr Modi will continue to control the narrative with his base in India.
"It's a larger constituency than the people who do not believe Mr Modi. With a near-complete control over the media narrative, I do not really see him losing the battle of perception. His supporters will believe that while Mr Modi went about his business as usual, Mr Khan was forced to speak up and release the pilot under pressure," says Santosh Desai, columnist and author, most recently, of Mother Pious Lady - Making Sense of Everyday India.
Whoever has won the battle of perceptions, there in one silver lining in this sorry saga. According to Vipin Narang, professor of political science at MIT, neither side seems to want a war. He believes that they "have had their Cuban Missile Crisis moment and recognise how a couple of wrong turns could set off uncontrollable escalation".
So both sides could get back to business. "Pakistan could finally crack down on terrorism and avoid getting the music started. India could continue strategic restraint," he says.
Read more from Soutik Biswas
Follow Soutik at @soutikBBC