Militants were Sunday holding up to 15 people hostage near Islamabad after a bid to storm Pakistan's army headquarters left six soldiers and four attackers dead, officials said.

Up to ten suspected Taliban gunmen in military uniform armed with automatic weapons and grenades drove up to the compound just before midday Saturday and shot their way through one checkpost in the garrison town of Rawalpindi.

Four militants were killed at a second post but the rest fled during the fierce firefight, barricading themselves into an office just outside the compound, where gunfire continued to ring out as soldiers swarmed the area.

The siege in the heart of Pakistan's military establishment comes as militant attacks surge, with analysts saying the Taliban are trying to deter an imminent army offensive into their tribal stronghold along the Afghan border.

Military spokesman Major General Athar Abbas said that between eight and ten "terrorists" staged the audacious attack, with four militants and six soldiers killed in the initial firefight in the city adjoining the capital Islamabad.

He said up to five gunmen escaped and "have taken some security personnel as hostages", adding that between 10 and 15 people were still in militant hands more than 12 hours after the assault began.

"We have surrounded the building -- it (a rescue operation) hasn't started as yet. We are going to work out the timing of the operation," Abbas told AFP.

"We are trying to move with the minimum loss of life," he said, adding that he was not able to disclose if any negotiations were ongoing with the rebels.

Security officials said the hostages were being held in a building linked to the military headquarters near the second checkpost.

An AFP reporter at the scene said that soldiers were perched at the ready on nearby rooftops, with all the lights blacked out in military and civilian buildings within one kilometre (half a mile) of the army headquarters.

Sporadic outbursts of gunfire were heard around midnight, but it was unclear where the shots were coming from.

A security official requesting anonymity told AFP that a brigadier and a lieutenant-colonel were among the dead, while intelligence officials at the scene said the hostages included high-ranking military personnel.

Interior Minister Rehman Malik said in an interview with CNN that they were determined to take the gunmen alive so they "will give us more information", adding later on local TV that he believed the Taliban were to blame.

"The Taliban are hired assassins. They are the enemies of Islam and Pakistan. All their actions are against the sovereignty of Pakistan," he said.

The Tehreek-e-Taliban Pakistan (TTP) movement is based in the northwest tribal belt. The umbrella group of Islamist militia is blamed for most the attacks which have killed more than 2,200 people in the country in two years.

The firefight came a day after a suicide car bomb killed 52 civilians at a busy market in the northwest city of Peshawar.

Government ministers blamed the suicide attack on the Taliban, who have vowed to avenge the death of their leader Baitullah Mehsud in a US drone missile attack in August.

The military is wrapping up a fierce offensive against Taliban rebels in the northwestern Swat valley launched in April, with the army now poised to begin a similar assault in the nearby semi-autonomous tribal belt.

Taliban and Al-Qaeda rebels who fled Afghanistan after the 2001 US-led invasion have carved out boltholes and training camps in the remote Pakistani mountains, with the TTP leadership also holed up in the rugged terrain.

Several bomb blasts in Pakistan in the past two-and-a-half weeks have killed dozens, with the Taliban threatening to unleash bigger assaults.

The TTP claimed responsibility for a suicide attack on Monday on a UN office in Islamabad which killed five aid workers.

There was a lull in bomb attacks after Baitullah Mehsud's death in an August 5 US drone strike, but analysts had warned that the new Taliban leadership would likely be keen to show their strength with fresh, dramatic strikes.

This video is from Al Jazeera, published to YouTube on Oct. 10, 2009.

[youtube expand=1]

This video is from ITN News, published to YouTube on Oct. 10, 2009.

[youtube expand=1]

With AFP.