Islamabad CNN  — 

The captured Indian pilot at the center of one of the gravest military crises in South Asia in years was released from Pakistani custody in a dramatic night-time handover at a border post between the two countries on Friday.

The pilot, identified as Wing Commander Abhinandan Varthaman, found himself at the center of soaring tensions between the nuclear-armed neighbors after his MiG-21 jet was downed during a dogfight between Pakistani and Indian warplanes over the ceasefire line in the disputed Kashmir region on Wednesday.

Dressed in a blue blazer and white shirt, a solemn-looking Varthaman was escorted by Fareeha Bugti, the director of the India desk in Pakistan’s Foreign Office and Pakistani soldiers to the Wagah border crossing between the two countries as cameras rolled on Friday. After passing through the border gate and into India, he was ushered away by Indian forces.

Troops lined both sides of the crossing ahead of the handover, which was delayed by several hours for unknown reasons. Hundreds of people amassed on the Indian side of the border in the afternoon, drumming, dancing and waving the Indian national flag in anticipation of the pilot’s return.

One of Varthaman’s first stops was for a medical checkup, RGK Kapoor, Air Vice Marshal of the Indian Air Force told the media moments after the handover.

“This checkup is mandated particularly because the officer has had to eject from an airplane which would have put his entire body under great stress,” Kapoor said. “IAF (Indian Air Force) is happy to have him back.”

Local TV stations carried live shots of the pilot being taken to a military hospital in the capital late on Friday night.

Earlier Friday, the Pakistani foreign ministry said Varthaman “was treated with dignity and in line with international law” during his several days in captivity.

Pakistani Prime Minister Imran Khan has described the release of the pilot as a “gesture for peace” in an attempt to defuse the spiraling crisis between the two countries.

Indian Prime Minister Narendra Modi sent well-wishes to the pilot after the handover in a post on Twitter.

“Welcome home Wing Commander Abhinandan! The nation is very proud of your exemplary courage,” he tweeted Friday.

Modi added that India’s armed forces were an “inspiration” to its 1.3 billion citizens.

Despite the gesture, Indian officials have so far remained guarded. India’s Minister of State for External Affairs, Vijay Kumar Singh, said Pakistan “has not done us a favor” by adhering to the Geneva Conventions and returning its pilot.

In a written statement on his Twitter account, Singh said India welcomed the move, but that “it is the first of many steps that #Pakistan must take to reinforce their commitment to peace.”

Tensions in Kashmir

The stand-off has seen both sides engage in increased military exchanges across the heavily fortified Kashmir border. At least four Pakistani civilians have died and eight were injured in cross-border shelling from India since Thursday night in several areas in Pakistani-controlled Kashmir, Raja Moazzam, Pakistan state director for disaster management, told CNN Friday.

Moazzam said dozens of houses have been damaged from shelling and hundreds of people have been moved to other areas. About 600 people are taking shelter in state-run camps, he said.

India has accused Pakistan of initiating the exchange of fire.

Speaking with CNN’s Christiane Amanpour on Thursday, Pakistan’s foreign minister, Shah Mehmood Qureshi, said that the release of the pilot should be seen as an expression of his country’s willingness to de-escalate.

He also confirmed that Masood Azhar, leader of the Jaish-e-Mohammed militant group that India said it targeted in its pre-dawn strike in Pakistan territory on Tuesday, is in Pakistan. “He is very unwell,” Qureshi said. “He is unwell to the extent that he cannot leave his house, because he is really unwell, so that’s the information I have.”

Pakistani Rangers and Indian Border Security Force personnel fold their respective national flags as they perform during the daily beating of the retreat ceremony on the India-Pakistan Border at Wagah on February 20, 2017.

Differing narratives

In what has become a hallmark of the crisis, the two sides have stood by differing accounts of what occurred in the skies over Kashmir.

On Wednesday, Pakistan said its air force shot down two Indian fighter jets. India confirmed the loss of one plane and said it shot down a Pakistani jet as it responded to the incident.

Indian military officials accused Pakistan of “factually incorrect statements” on its plane shootings and intentionally targeting military installations. Pakistan said it dropped weapons in open space where there was no human presence or military posts.

The Wagah border crossing, where the pilot was handed over, is known for its daily parade called the “beating retreat” ceremony. But Indian Border Security Force (BSF) spokesperson Subhendu Bhardwaj told CNN on Friday the parade has been canceled on the Indian side.

Every evening there for 60 years, Pakistan’s Rangers and India’s Border Security Force take part in a lowering-of-the-flags ceremony before sunset.

The ceremony, which ends with soldiers folding their countries’ flags and shaking hands, draws attendees from both sides of the border, as well as international tourists.

Simmering resentment

The immediate trigger for the latest confrontation was a suicide car bomb attack on February 14 in Indian-controlled Kashmir, which killed 40 Indian paramilitary soldiers. India blamed the terrorist group Jaish-e-Mohammed for the attack, the deadliest on security forces since the beginning of the insurgency in the late 1980s.

“The world is watching our collective will. We trust our army’s capability and because of this, it is extremely necessary that nothing should happen that harms their morale or that our enemies should get a chance to raise a finger against us,” Modi said Thursday.

After the February 14th attack, Modi expressed “deep anger” and promised that those responsible would pay a heavy price. However, he has been quiet in recent days.

Modi’s reluctance to make a public comment on the escalating crisis along the border in disputed Kashmir is in stark contrast to Pakistan Prime Minister Khan, who called for dialogue between the two sides.

Speaking in a national address Wednesday, Khan said that any further escalation between the countries would be beyond the two leaders’ control. He warned that because India and Pakistan had nuclear weapons, the stakes were too high for any “miscalculation” in conflict.

“World history tells us that there are miscalculations in wars. But my question to the Indian government is: Given the arms that we and you have, can we afford any miscalculation?” he said. “It will neither be in my control, nor in the control of (Indian Prime Minister) Narendra Modi.”

CNN’s Swati Gupta and Adeel Raja contributed to this report.