LAHORE, Pakistan — A group of gunmen, some in police uniforms, attacked a police academy Monday and held it for hours, seizing hostages, throwing grenades and killing at least six trainee officers before being overpowered by Pakistani commandos.

Four suspected militants were arrested while at least three blew themselves up in the eight-hour battle to retake the compound on the outskirts of Lahore in eastern Pakistan, said Rao Iftikhar, a top government official in Punjab province.

He said three other bodies were still unidentified.

Interior Ministry chief Rehman Malik said one of the arrested man was an Afghan, and that investigators believe the attack may have its roots along Pakistan's border with Afghanistan, where Taliban militants have hideouts. But Malik also pointed fingers at a Punjab-based Sunni extremist group and also refused to rule out an Indian role.

Meanwhile, a member of the Pakistani Taliban who uses the name Omar Farooq told The Associated Press by phone that a little-known group called Fedayeen al-Islam was behind the attack and that he was speaking on their behalf.

"As long as the Pakistan troops do not leave tribal areas, these attacks would continue," he said, referring to military operations in the lawless regions next to Afghanistan.

Officials said more than 90 officers were wounded and that some of the attackers wore police uniforms in Monday's attack. As the siege ended, black-clad Pakistani commandos fired their guns in the air in celebration at the top of the building, shouting "God is Great!" and "Long live Punjab police!"

The highly coordinated attack underscored the threat that militancy poses to the U.S.-allied, nuclear-armed country. Malik, Pakistan's top civilian security official, said that militant groups were "destabilizing the country."

The ambush on the Manawan Police Training School began as dozens of the officers carried out morning drills. About 700 trainees were inside at the time.

"We were attacked with bombs. Thick smoke surrounded us. We all ran in panic in different directions," said Mohammad Asif, a wounded officer taken to a hospital. He described the attackers as bearded and young.

Another officer, Ahsan Younus, told The Associated Press that some of the attackers wore police uniforms and took some of the police hostage.

TV footage showed several frightened police officers jumping over the wall of the academy to flee. Some crouched behind the wall of the compound, their rifles pointed toward the parade ground where police said the attack took place. Farther back, masses of security forces and civilians monitored the tense standoff, taking shelter behind security and rescue vehicles.

Televised firefightThe forces had surrounded the compound, exchanging fire in televised scenes reminiscent of the militant siege in the Indian city of Mumbai in November and the attack on Sri Lanka's cricket players earlier this month in Lahore.

At one point, security forces cornered several militants on the top floor of a building on the compound, where the gunmen held about 35 hostages, Iftikhar said.

"The eight hours were like eight centuries," said Mohammad Salman, 23, one of the hostages. "It was like I died several times. I had made up my mind that it was all over."

Police captured one of the suspected gunmen six hours after the initial assault, dragging the scruffy, bearded man to a field outside the academy and kicking him.

On the roof of the building where hostages were kept, an AP photographer saw body parts, blood and spent ammunition strewn about, and several police officers — apparently hostages — came out with their hands above their heads in fear.

No militant group immediately claimed responsibility, but Malik suggested it could have been Lashkar-e-Jhangvi, a Punjab-based al-Qaida-linked terrorist group that has been implicated in several other attacks in the country.

Pakistan has endured scores of suicide bombings and other attacks in recent years, and it faces tremendous U.S. pressure to eradicate al-Qaida and Taliban insurgents on its soil. Most of the violence occurs along the country's northwest border with Afghanistan, but attacks have occurred in all the major cities.

Monday's attack occurred close to the Indian border.

Threat of insurgencyThe attacks pose a major test for the weak, year-old civilian administration of Pakistani President Asif Ali Zardari, which has been gripped with political turmoil in recent weeks. The Obama administration has warned Pakistan that militancy threatens the nation's very existence, while U.S. officials complain the country's spy agencies still keep ties with some of the insurgent groups.

Malik said Pakistan's integrity was "in danger at this time" and suggested that a foreign country was interfering in the country's domestic affairs, a possible reference to longtime foe India.

"Some rival country, or some hostile (intelligence) agency is definitely out to destabilize our democratic forces," he told reporters in Lahore.

Earlier, he told state-run TV that Pakistan's police were not equipped to fight the wave of terrorism.

"In our country, at our different borders, arms are coming in, stinger missiles are coming in, rocket launchers are coming in, heavy equipment is coming — it should be stopped," Malik said. "Whoever the anti-state elements are, they are destabilizing the country."

Lahore a targetIndia's Foreign Secretary Shivshankar Menon told reporters his country was "deeply saddened and shocked by the events in Lahore."

British Foreign Secretary David Miliband released a statement condemning the attack.

The U.S. Embassy in Islamabad issued a warning advising Americans to avoid travel between Lahore and the Indian border and prohibiting its employees from doing the same.

Lahore, a vibrant metropolis considered by many to be Pakistan's cultural capital, has become an increasingly alluring target for militants. The cricket ambush in early March sparked a battle that left six police officers and a driver dead and wounded several players.

The brazen assault used commando-style tactics reminiscent of measures used by the militants who laid siege to several parts of Mumbai last year for three days. The Sri Lankan attack also had similar features — including heavily armed, backpack-toting gunmen — but it was much quicker. Observers have since speculated that those attackers might have hoped to grab hostages as well.

No 'blank check'India has blamed the Pakistani militant group Lashkar-e-Taiba for the Mumbai assault, and Pakistan has taken several of the outfit's alleged leaders into custody. Lashkar-e-Taiba, which is largely based in eastern Punjab province, has denied involvement in both attacks.

Several militant groups operate well beyond Pakistan's northwest. Some of them, including Lashkar-e-Taiba, have their roots in the Kashmir dispute with India, and Pakistani spy agencies are believed to have established them.

Pakistan's stability is of paramount concern to the U.S., which is fighting a growing Taliban insurgency in Afghanistan more than seven years after the American-led invasion ousted the militant regime from power there. Al-Qaida and Taliban fighters are believed to hide out in Pakistan's northwest while planning attacks on U.S. and NATO forces in Afghanistan.

In unveiling a new strategy for Afghanistan last week, President Barack Obama pledged more aid to Pakistan but warned it not to expect a "blank check" without any accountability. Obama pledged increased assistance to Pakistani security forces, specifically equipment for the military.