By Fayaz Bukhari

SRINAGAR, India (Reuters) - Militants attacked an army base near the Indian city of Jammu on Tuesday, killing at least seven security personnel and taking hostages in the boldest assault on a military base in the region in recent months, officials said.

The gunmen raided the base just before dawn, firing at officers before entering the officers' mess, where they took security men, women and children hostage for several hours, Jammu-based army spokesman Manish Mehta said.

Soldiers fought back, securing the buildings and freeing the hostages, Mehta said. Three militants were killed during the attack, which took place in India's northern Jammu and Kashmir state.

"We have tightened the cordon and a combing operation will resume in the morning. If there is any militant, he will be neutralized," Mehta said. The Indian army casualties included five soldiers and two officers.

Jammu and Kashmir state is part of the Muslim-majority Himalayan region of Kashmir. That region has been divided between arch-rivals India and Pakistan since independence from Britain in 1947 but is claimed in full by both.

Tuesday's attack comes on the same day Pakistan's new army chief, Lieutenant General Qamar Javed Bajwa, took charge, and the powerful outgoing army head, General Raheel Sharif, issued a stern warning to India over violence in Kashmir.

Later this week, Pakistan officials are due in the Indian city of Amritsar for an Asian regional summit.

The raid in Jammu was the deadliest since a Sept. 18 assault on an army base in the state that killed at least 19 Indian soldiers - the worst such assault in 14 years - triggering an escalation in tensions between the two countries.

India accuses Pakistan of supporting militants 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.

India's portion of Kashmir has been gripped by protests since security forces killed a popular separatist leader in July. A crackdown in response to the protests has paralyzed much of the region and more than 80 civilians have been killed.

Indian police said on Tuesday they had also stopped an attempt by militants to cross into India south of Jammu, and killed three of the gunmen.

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 frontier has also intensified as tension between the nuclear-armed neighbors has risen.

(Writing by Tommy Wilkes; Editing by Larry King)