Pakistan returned a captured Indian fighter pilot late on Friday, after a dramatic clash between regional rivals that him shot down over the fiercely-contested Kashmir border region.

According to reports in local media, Wing Commander Abhinandan Varthaman parachuted from his stricken plane, fended off locals on the ground by firing warning shots from his pistol, and swallowed sensitive paperwork to keep it secret.

Varthaman was shot down and captured on Wednesday when the two countries clashed in the air, the latest in a series of encounters following a February 14 terrorist attack that left 40 Indian troops dead.

When Varthaman landed he asked if he was in India or Pakistan, two witnesses told Reuters.

On hearing he was in Pakistan, he fired a shot into the air as locals picked up stones, the witnesses said.

Varthaman in a video released by Pakistani officials. (Inter Service Public Relation handout via Reuters)

According to the witnesses, he then ran, firing shots behind him, and jumped into a small pond where he took out documents and maps, ate some of them and soaked others in water to prevent Pakistan from getting them.

He was then restrained by the locals until Pakistani soldiers arrived.

Abdul Majeed, 40, told Reuters that he was one of the locals who had beaten and thrown stones at Varthaman.

“While in the stream he once again pointed his revolver at us and fearing that he may shoot directly at us, I threw a stone at him,” he said.

“Some of us did thrash him… because he had given us a tough time. But later we handed him over to the army personnel.”

A witness, who was not named, gave the same details to Pakistan's Dawn newspaper.

Children holding banners and Indian flags to celebrate the return of Varthaman, who's being described as a hero. (Reuters/Francis Mascarenhas0

Varthaman was kept in Pakistan's custody until Friday, when he was returned to India in what Pakistani Prime Minister Imran Khan called a “peace gesture.”

Footage broadcast on Pakistani state TV showed Varthaman, surrounded by soldiers, crossing into India on foot, where he is set to be welcomed as a hero.

Pakistan shared videos of the pilot in their custody

Shortly after his capture, Varthaman was shown in video published by Pakistan with a bloodied face and wearing a blindfold — treatment which experts say could violate international treaties. Pakistan's information ministry later deleted the video on its Twitter account.

A video tweeted and later deleted by the Pakistan's information ministry showed the pilot blindfolded and with a bloody face. (Pakistan Information Ministry)

In it, he gave his name, rank, and service number, and called his captors “sir.”

Officials later shared a second video of the pilot, that shows him drinking tea and saying that Pakistan is treating him well.

“I would like to put this on record & I would not change my statement if I go back to my country. The officers of the Pakistan Army have looked after me very well. They are thorough gentlemen,” he says in the video.

The videos helped Varthaman become the face of the conflict between the two nuclear powers, which could have become a “mutual suicide” for the two nations had it escalated into war, Pakistan's foreign minister told CNN.

Indian military officials said on Thursday that they welcomed the return of Varthaman, but refused to say if they considered his return to be a de-escalation of the conflict, Reuters reported.

Air Vice Marshal RGK Kapoor said at a joint news conference of India's three armed forces on Thursday evening that India is “happy” that Varthaman was to be released the next day. He did not answer reporters who asked if whether this would de-escalate the conflict.

Shah Mehmood Qureshi, Foreign Minister of Pakistan, told CNN's Christiane Amanpour that Pakistan wants “peace and stability in the region.” Khan previously questioned whether the countries could “afford miscalculation” given the devastation that could be caused by their nuclear arsenals.

World leaders such as the United States, EU, and China had urged the countries to exercise caution, emphasizing the importance of peace in the region.

Read more from Business Insider:

SEE ALSO: This Indian Pilot Was Shot Down And Captured In Pakistan. Now He's The Face Of The Escalating Crisis Between The Countries

WATCH NEXT: The Guy Who Reportedly Sent His Resume To ISIS