Ten people including three civilians were killed on Monday when gunmen wearing army uniforms stormed a police station in northern India near the border with Pakistan, sparking a shootout lasting almost 11 hours.
Police said three attackers had been killed in the battle with security forces that began in the early hours of Monday and terrified local residents.
Four police officers including the local superintendent also died in the operation in the usually calm northern state of Punjab.
"The police superintendent fought them bravely but unfortunately he was shot in the head and he died on the spot," said Anand Kumar, part of the special forces team that entered the building.
The assault only ended at around 5pm when security forces finally entered the police station where the unidentified gunmen had been holed up.
Local television stations showed scores of special forces personnel flashing victory signs and chanting slogans as they celebrated outside the partially damaged building.
One civilian was killed when the attackers opened fire at a bus station while the other two died at the police station, said Sumedh Singh Saini, director general of police for Punjab.
He told reporters it was "too early to say" who the attackers were.
Five live bombs were recovered from nearby railway tracks, forcing train services to be cancelled.
India's national security adviser, Ajit Doval called it "a very serious terrorist attack," according to local NDTV television news channel.
Home Minister Rajnath Singh said he had ordered increased security on the border with Pakistan, which condemned the assault in a statement.
Singh will make a detailed statement over the attack in Parliament on Tuesday.
A number of other states were also reported to be on high alert.
- National problem -
It was the first major attack in India's Punjab for more than a decade and the state's Chief Minister Parkash Singh Badal blamed a lack of security on the border.
"This militancy is a national problem, not a state problem, so it needs to be tackled with a national policy," he told reporters.
"If prior intelligence input had been given, they should have properly sealed the borders."
Insurgents frequently target police in the volatile Kashmir region, which is divided between arch rivals India and Pakistan and claimed in full by both.
But neighbouring Punjab, a majority-Sikh state, has largely been spared the violence that has plagued Indian Kashmir.
An armed rebellion for a separate Sikh homeland erupted in Punjab in 1983 but waned in the early 1990s.
About 50,000 people died in that conflict, which India blamed at the time on Pakistan.
Some media reports suggested the attackers behind Monday's assault in Gurdaspur may have crossed into Punjab from Kashmir.
Monday's attack comes weeks after Indian Prime Minister Narendra Modi and his Pakistani counterpart Nawaz Sharif spoke for about an hour during a summit in Russia.
The meeting raised hopes of an improvement in perennially difficult relations, but was swiftly followed by a flare-up in violence along the de facto border in Kashmir.
India regularly accuses Pakistan's army of providing covering fire for rebels who infiltrate across the border and then mount attacks in the Indian sector of Kashmir.
The two countries have fought three wars since independence from Britain in 1947, two of them over the Himalayan region.