Police say four gunmen also killed during early morning raid on Nagrota army base in Indian-occupied Kashmir.

Seven Indian soldiers, including two officers, were killed when armed men attacked an army base in Indian-occupied Kashmir.

It was the most audacious attack on an Indian military base since the Uri attack in September, when 19 soldiers were killed in an assault that India blamed on Pakistan-based militants.

Police said the four gunmen who raided the base in Nagrota before dawn on Tuesday were killed in a standoff with security forces that lasted most of the day.

India’s NDTV reported the attackers, dressed in police uniforms, fired indiscriminately at the officers’ mess before taking up positions inside the building.

Helicopters and drones hovered over the building, according to the Hindustan Times.

The “hostage-like situation”, said an Indian army statement, was “very quickly contained” and 14 people, including two women and two children, were rescued.

“Bodies of three terrorists have been recovered and operations are in progress to sanistise the complete area,” the statement added.

The base, about 25km from the Pakistan border, is one of four command centres in the restive Himalayan region and home to more than 1,000 officers and their families. Three security officials were also wounded during the assault.

India said that after the Uri attack in September it launched “surgical strikes” on insurgent bases across the heavily militarised de-facto border known as the Line of Control (LoC) in disputed Kashmir, a claim Islamabad vehemently denied.

OPINION: Kashmir and the myth of indivisible India

Tuesday’s attack came as Pakistan’s hugely popular military chief General Raheel Sharif handed over the reins to his successor Qamar Javed Bajwa with a warning to India not to mistake his country’s “restraint” for weakness.

It also comes days before a scheduled visit to India by Sartaj Aziz, Pakistan’s foreign affairs adviser, for a weekend conference on Afghanistan.

“It [the attack] clearly suggests there is an attempt by certain groups to sabotage the apparent peace outreach by Pakistan’s government,” Mohan Guruswamy, head of the Centre for Policy Alternatives think-tank in New Delhi, said.

Kashmir conflict

The Muslim-majority Himalayan region of Kashmir has been divided between India and Pakistan since independence from Britain in 1947, but is claimed in full by both.

Attacks against Indian security forces have increased in recent months, although raids in the Hindu-majority Jammu area of the state are less common.

Indian and Pakistani cross-border firing along the heavily militarised LoC has intensified as tension between the nuclear-armed neighbours has risen.

India accuses Pakistan of supporting armed groups based on its side of the border who cross over to launch attacks. Pakistan denies that, accusing India of abusing the rights of Muslim Kashmiris opposed to Indian rule.

Kashmir has been gripped by protests since security forces killed a popular separatist leader in July. A crackdown in response to the protests has paralysed much of the region.