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.