Pathankot (India) (AFP) - A dramatic assault on an Indian air base near the Pakistan border was finally declared over Saturday 14 hours after suspected Islamist militants struck, leaving three security officers dead, authorities said, an attack that threatens to undermine the countries' fragile peace process.

At least four attackers also died in shoot-outs with security forces at Pathankot base in northern Punjab state, after gunmen suspected to be from the Pakistan-based Jaish-e-Mohammed Islamist group infiltrated the site at 3:30 am (2200 GMT) Saturday.

The assault -- a rare targeting of an Indian military installation outside disputed Kashmir -- comes a week after Prime Minister Narendra Modi paid a surprise visit to Pakistan, the first by an Indian premier in 11 years.

The possible involvement of Pakistan-based militants in the attack threatens to derail talks between the nuclear-armed rivals, who have fought three wars since independence in 1947.

"I congratulate our armed forces and other security forces on successfully neutralising all the five terrorists in 'Pathankot Operation'," Home Minister Rajnath Singh tweeted.

Security officials only confirmed that four attackers had died.

An Indian army source said "at least three security personnel have died" in the incident, with at least three others injured, adding that officers were still combing the base for residual explosives.

Modi, on a visit to the southern city of Mysore, responded to the attack on Twitter Saturday evening.

"Enemies of humanity who can't see India progress, such elements attacked in Pathankot but our security forces did not let them succeed," he tweeted.

Pakistan also moved to condemn the attack, and voiced optimism over continued dialogue with its long-time foe.

"Building on the goodwill created during the recent high-level contacts between the two countries, Pakistan remains committed to partner with India... to completely eradicate the menace of terrorism afflicting our region," Islamabad's foreign ministry spokesman said.

Story continues

- Strategic base -

The Pathankot air base houses dozens of fighter jets and is important for its strategic location about 50 kilometres (30 miles) from the Pakistan border.

"They are from Jaish, Jaish has claimed responsibility," Indian army Lieutenant General Satish Dua told reporters of the attackers. AFP was not able to verify the alleged claim of responsibility.

Jaish-e-Mohammed, which is banned in Pakistan, fights against Indian rule in the divided Himalayan region of Kashmir, where a separatist conflict has claimed up to 100,000 lives.

While Punjab has largely been spared such violence, however, it has not been immune.

In July, three gunmen said to be Pakistan-based Lashkar-e-Taiba militants killed seven people, including four policemen, in an attack in the Sikh-majority state.

Modi's December 25 visit to the Pakistani city of Lahore to meet his counterpart Nawaz Sharif indicated a potential thaw in tensions, and the foreign secretaries of both countries are to meet in Islamabad this month.

Pakistan opposition senator Sherry Rehman said the attack must not disrupt the planned dialogue.

"#Pathankot is about derailing peace. Don't let terror define our agenda. Pak-India talks must go on."

But Modi's friendly outreach to Pakistan had prompted critics to warn of retaliation by militants.

"Our prime minister visited and after that the terrorists came here. They want friendship with Pakistan but look what they are doing to us," said Ashok Kumar, 52, a shopkeeper in Pathankot.

A protest broke out on the road leading to Pathankot base in the early afternoon as angry residents burned effigies apparently intended to resemble Pakistani militants, an AFP journalist said.

- Fragile peace -

Sameer Patil, a security analyst at the Gateway House think-tank in Mumbai, said Saturday's attack was likely to be a cross-border strike possibly carried out in retaliation for the visit.

"There is substantial first evidence of Jaish-e-Mohammed and Lashkar-e-Taiba militants trying to sabotage the peace process," he told AFP.

India blamed Jaish-e-Mohammed for a December 2001 attack on the Indian parliament that killed 11 people, led to a massive military build-up at the border and brought the two countries almost to the brink of war.

New Delhi later suspended all talks with Islamabad after Islamist gunmen attacked the city of Mumbai in November 2008, killing 166 people in attacks planned from Pakistan.

The two countries agreed to resume a peace process in 2011 but tensions spiked again in recent years, with cross-border shelling in Kashmir claiming dozens of lives since 2014.

Authorities had put Punjab on high alert Friday after five gunmen in army fatigues hijacked a car driven by a senior police officer, which was later found abandoned on a highway connecting Pathankot to Kashmir.

It was not clear if there was any link with Saturday's attack.