A pre-dawn attack on an Indian air force base has left four gunmen and three soldiers dead and has also threatened to derail attempts to revive a dialogue between Pakistan and India.

A group of gunmen attacked the base in the Indian northwestern state of Punjab that borders Pakistan, local officials said.

The attack, 50km from the border with Pakistan, comes just a week after Indian Prime Minister Narendra Modi had made a surprise Pakistan visit to meet his counterpart in a bid to revive bilateral talks that had previously been derailed by militant attacks.

Sporadic gunfire continued into the day and helicopters flew as an operation continued to comb the base in Pathankot where four gunmen were killed in a shoot-out with security forces early on Saturday morning.

The attackers had earlier hijacked a police officer's car and driven it to the heavily guarded base - tactics used in earlier attacks believed to have been perpetrated by Pakistani-trained fighters, Punjab's police chief Suresh Arora told Reuters.

There was no immediate claim of responsibility.

IAF spokeswoman Rochelle D'Silva said that the gunmen entered the living quarters of the base, about 430km north of New Delhi, but were not able to penetrate the area that houses fighter helicopters and other equipment.

Earlier, officials said the exchanges of fire had ended at the cantonment.

The air base has been cordoned off and a heavy contingent of police have been deployed to the area, with elite paramilitary force of the National Security Guard (NSG) and the Guard Commando Force called in.

A senior Indian police officer said that a red alert has been issued across Punjab state in the wake of the incident.

Al Jazeera's Faiz Jamil, reporting from New Delhi, said the attack began at around 3:30am local time (22:00 GMT) and that the attackers had entered the base wearing military uniforms.

"Officials are not sure yet who these gunmen are," he said, adding that officials were saying that the remaining attackers had been contained to a non-operational area of the base.

Pathankot is the road and rail gateway to India-administered Kashmir, which has witnessed armed rebellion against Indian rule.

Uday Bhaskar from Society for Policy Studies said that there was a fair amount of speculation and conjecture about the identity of the attackers, adding that official statement was still awaited.

"As an analyst I would say the probability that perpetrators are linked to one of the better known terror groups that have targeted India over the last decade is fairly high.

"There are couple of groups that come to mind such as Jaish-e-Mohammad or Lashkar-e-Taiba," he said.

India's Interior Minister Rajnath Singh said India wanted peace with Pakistan but that any terrorist attack would get "a befitting response".

Pakistan later condemned the attack and said it wanted to build on the goodwill created in the recent high-level contacts.

"Pakistan remains committed to partner with India as well as other countries in the region to completely eradicate the menace of terrorism," foreign ministry spokesman Qazi Khalilullah said in a series of tweets.

According to early accounts, the attack resembled a similar raid last year by gunmen on a border town in Punjab that killed nine people.

India blamed that attack on assailants who had infiltrated from Pakistan.

The latest attack is likely to deal a blow to attempts to revive political dialogue between the two nuclear-armed neighbours.

"I think the motive seems to disrupt the current traction as far as India-Pakistan bilateral relations is concerned," Bhaskar told Al Jazeera.

"We have had similar pattern in the past where those groups and constituencies that are against any improvement in bilateral relations play terror card. I see it as part of this pattern," he said.

"How Pakistan would respond would be an indicator about the next course of events in bilateral ties."