WAGAH, India/MUZAFFARABAD, Pakistan (Reuters) - Pakistan handed back a captured Indian pilot on Friday as the nuclear-armed neighbors scaled back a confrontation that has prompted world powers to urge restraint, although shelling continued in the disputed Kashmir region.

Television footage showed Wing Commander Abhinandan Varthaman walking across the border near the town of Wagah just before 9 p.m. (1600 GMT). Indian officials confirmed he had been returned and said he would be taken for medical checks.

“While in captivity, he (Abhinandan) was treated with dignity and in line with international law,” the Pakistani Foreign Ministry said in a statement.

Prime Minister Imran Khan announced his return “as a goodwill gesture aimed at de-escalating rising tensions with India”, it added, echoing Pakistan’s stance this week that wants to resolve the conflict through talks.

Abhinandan’s MiG-21 jet was shot down by a Pakistani fighter during a clash over Kashmir on Wednesday as two weeks of growing tensions between the two countries erupted into open hostilities.

The plane crashed on the Pakistani side of the de facto border that separates the two sides of Kashmir, a Himalayan region that has been a source of hostility between the two countries since independence from Britain in 1947.

Tensions escalated rapidly following a suicide car bombing on Feb. 14 that killed at least 40 Indian paramilitary police in Indian-controlled Kashmir.

India accused Pakistan of harboring the Jaish-e Mohammad group behind the attack, which Islamabad denied, and Prime Minister Narendra Modi promised a strong response.

The conflict came at a critical time for Modi, who faces a general election that must be held by May and who had been expected to benefit from nationalist pride unleashed by the standoff.

But his government faced growing questions from opposition parties after announcing on Tuesday that Indian warplanes had destroyed a major Jaish-e Mohammad training camp in Pakistan, killing “a very large number” of militants.

Pakistan said the Indian planes missed whatever they were aiming at, and that nobody died in the attack outside Balakot, a small town in Pakistan’s Khyber Pakhtunkhwa province. Reuters reporters who visited the scene could see no sign of damage apart from four craters and some splintered trees. Villagers in the area said one man had been slightly hurt.

“People should decide if they trust India’s armed forces or not,” Amit Shah, president of India’s ruling Bharatiya Janata Party, said at an event on Friday, referring to opposition calls for more information about the attack.

“Those who are doubting are helping Pakistan.”

Kashmir, a Muslim-majority area that has been at the root of two of the three wars fought between India and Pakistan, is claimed by both India and Pakistan, who both control a part of the region. India has fought a three-decade old insurgency by Islamist militants in its part of the region.

ORDEAL

The Indian pilot’s ordeal made him a focal point of the crisis for Indians, after footage of his battered face was shown on Pakistani television and social media shortly after he was captured.

Waiting for Abhinandan’s return on Friday, crowds thronged the road to the crossing, shouting nationalist slogans and waving Indian flags. The handover took place hours later than expected, for reasons that were not clear.

Slideshow ( 16 images )

“Pakistan is releasing our pilot, I thank them for that,” said Kulwant Singh, who has run a food stall at the crossing for 20 years. “War can never be good. War is bad for business, war is bad for our soldiers.”

Before his release, Pakistani television stations broadcast video of Abhinandan in which he thanked the Pakistani army for saving him from an angry crowd who chased him after seeing him parachute to safety.

“The Pakistani army is a very professional service,” he said. “I have spent time with the Pakistan army. I am very impressed.”

Witnesses in Pakistan-controlled Kashmir said that after the pilot ejected from his plane he found himself facing angry villagers and ran off, firing his pistol into the air to deter them.

Slideshow ( 16 images )

“During that half a kilometre run, he fired some more gunshots in the air as well, to frighten the guys but to no avail,” said Muhammad Razzaq Chaudhry, 58.

“Then he jumped into a small stream. Then, he realized that he could not escape, he took out some documents and maps from his uniform and tried to swallow some, tear apart and immerse the rest.”

Abdul Majeed, 40, said he was one of a number of villagers who had beaten and thrown stones at the pilot.

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

AIRSPACE RE-OPENED

Amid signs the conflict may be easing, Pakistan re-opened some airports on Friday after easing airspace restrictions that had disrupted flights between Asia and Europe for several days.

But firing continued along the contested border dividing Kashmir, according to officials in both countries, with at least two killed and two wounded on the Pakistani side.

“It has been heavy shelling since last night in Pandu sector, causing severe damage to at least eight houses and one shop,” said Imran Shaheen, a senior official in the Jhelum Valley district of Pakistani-administered Kashmir.

The United States and other world powers have urged restraint as tensions rose.

Pakistan’s army chief, General Qamar Javed Bajwa, discussed the situation in a telephone call with top military officials from the United States, Britain and Australia and said Pakistan would “surely respond to any aggression in self-defense”, according to Pakistan’s chief military spokesman.

On the diplomatic front, relations between the two countries remained strained. Foreign Minister Shah Mahmood Qureshi boycotted a meeting of foreign ministers from the Organisation of Islamic Cooperation in Abu Dhabi because his Indian counterpart had been invited to the event.