An officer and three soldiers were killed while fighting the terrorists when they barged into the base around 5.30 am and fired indiscriminately. The terrorists entered two buildings occupied by officers and their families. After several hours, a dozen soldiers, two women and two children were rescued, but in the operation, a second officer and two more soldiers were killed.

The Nagrota base is one of four command centres in Jammu and Kashmir and home to over 1,000 officers. It is the headquarters of the army's 16 Corps, a massive military formation that defends the borders and fights terrorists in the greater Jammu region.

The army will investigate later how the attackers breached the highly fortified base, but officers said the terrorists were from the fidayeen or suicide squad and were "determined to get in". Army chief General Dalbir Singh Suhag briefed Prime Minister Narendra Modi and Defence Minister Manohar Parrikar about the attack.

All schools were shut down in the vicinity and traffic has been stopped on the highway, which is very close to the army base. Security has also been tightened at the Vaishnodevi shrine some 30 km away.

Defence Minister Parrikar said: "Statistics have shown the attack is on military installations. Civilians are not being targeted."

The Army has released the names of six of the seven personnel who died in the ambush: Major Gosavi Kunal Mannadir, Major Akshay Girish Kumar, Havildar Sukhraj Singh, Lance Naik Kadam Sambhaji Yeshowanttro, Grenadier Raghvendra Singh and Rifleman Asim Rai. The name of the seventh soldier was not released as the army is yet to inform his family.

Separately and south of Jammu, the Border Security Force intercepted a group of terrorists and killed three of them while they were attempting to cross over the International Border from Pakistan into India at the Samba sector.

Today's attacks in Jammu coincided with a new Pakistan army chief, General Qamar Javed Bajwa, taking charge from General Raheel Sharif, who said in a parting shot to India: "Don't mistake our patience for weakness."

Amid a sharp escalation in tensions between India and Pakistan, there has been a spurt in attacks and infiltration attempts by terrorists from across the border over the past few weeks.