RAWALPINDI, Pakistan (Reuters) -- Suspected militants dressed in army uniforms have attacked Pakistan's army headquarters, killing six guards and triggering a battle in which four gunmen were killed, military officials said.
The brazen attack on the tightly guarded headquarters in the city of Rawalpindi came as the army prepares a major offensive against Pakistani Taliban militants in their northwestern stronghold on the Afghan border.
Four of the gunmen were killed but military spokesman Major General Athar Abbas told state television that at least three gunmen were holding several hostages.
"They are holed up in a security office building," he said. "They have taken hostage some of our security forces. The building has been surrounded and appropriate action will be taken."
The gunmen initially drove in a white van to a main gate at the sprawling complex, opening fire and throwing at least one grenade when challenged, security officials said.
The gunmen then exchanged fire with soldiers for about 40 minutes. Four gunmen and six guards were killed but two of the gunmen escaped, military officials said.
Al-Qaeda-linked Islamist militants have launched numerous attacks in Pakistan over the past couple of years, most aimed at the security forces and government and foreign targets.
The militants have attacked military targets in Rawalpindi before.
Television pictures showed the militants' white van, its doors open, where the gunmen abandoned it by concrete barriers outside the gate.
The attack came a day after a suspected suicide car bomber killed 49 people in the city of Peshawar in an attack the government said underscored the need for the all-out offensive.
Early this year, the militants pushed to within 100 kilometers of Islamabad, raising fears for nuclear-armed Pakistan's stability. An exasperated U.S. Secretary of State Hillary Clinton said the government appeared to be "abdicating" to the militants.
The United States needs Pakistani help against militants crossing into Afghanistan to battle U.S.-led forces there.
But in late April the security forces launched a sustained offensive in the Swat Valley, 120 kilometers northwest of Islamabad, largely clearing Taliban from the region.
The militants suffered another big blow on August 5, when their overall leader, Baitullah Mehsud, was killed in an attack by a missile-firing U.S. drone aircraft in South Waziristan.
Mehsud's death and reports of infighting about who would take over as leader raised hopes that the militants were in disarray.
But in recent weeks violence has been picking up after a relative lull following Mehsud's killing.
The government ordered the army to go on the offensive in South Waziristan in June and security forces have been launching air and artillery strikes, while moving in troops, blockading the region and trying to split off factions.
The army has declined to say when it would send in ground troops.