Updated

Days of relative quiet in the Afghan war ended suddenly Sunday, as hundreds of pro-Taliban foreigners held captive by the Northern Alliance near the city of Mazar-e-Sharif seized weapons from guards and staged a bloody prison revolt.

U.S. warplanes helped alliance troops quell the uprising, but explosions could still be heard from the compound Sunday evening. Hundreds were reportedly killed in the uprising, but U.S. military forces were all accounted for, Pentagon officials said. A government official, speaking on condition of anonymity, said a CIA operative was wounded.

The prisoner rebellion apparently began when several of the foreign fighters — largely Pakistanis, Arabs and Chechens — detonated smuggled grenades inside the Qalai Janghi fortress, killing themselves and nearby guards and allowing other prisoners to grab weapons and start fighting.

The rioting prisoners appeared to have been part of a contingent of 600 Al Qaeda militants loyal to Usama bin Laden who had surrendered at Kunduz to Northern Alliance commander Gen. Rashid Dostum and been taken to his headquarters inside the fortress, 10 miles west of Mazar-e-Sharif.

Reuters reported that the foreigners had apparently gotten their hands on heavy weapons, as both sides battled it out with machine guns, grenade launchers and tanks.

"There was general pandemonium," said Simon Brooks, head of Red Cross operations for northern Afghanistan, who was at the prison to check on the detainees' condition when gunfire rang out.

Brooks said he fled from the compound by climbing onto the roof with Northern Alliance commanders, and when he returned in the afternoon he found three men with serious injuries making their way toward Mazar-e-Sharif.

Yahsaw, a spokesman for Northern Alliance commander Mohammed Mohaqik, said the militants broke down the doors and tried to escape, and then battled all day with guards.

"It was total chaos there," said Ulugbek Ergashev, a translator accompanying a German television crew at the fortress.

Alliance spokesmen claimed the rebellion had been put down by about 7 p.m. Sunday. A similar claim earlier in the day was demonstrably exaggerated.

"They were all killed, and very few were arrested," said Zaher Wahadat, another alliance spokesman.

A Pentagon spokesman confirmed that U.S. airstrikes had helped Dostum's forces regain control of the prison. Some U.S. special forces were in the compound when the fighting broke out, and Lt. Col. Dan Stoneking said "it appears all U.S. personnel are accounted for."

Dostum brought in about 500 of his troops and quashed the riot with the help of airstrikes from U.S. forces, Stoneking said.

While Afghan Taliban troops have had an relatively easy time surrendering — or defecting — to alliance forces in the past few weeks, foreign Al Qaeda fighters — regarded as invaders and meddlers by most Afghans — face an uncertain future in alliance hands.

Former Afghan President Burhanuddin Rabbani, titular head of the loosely structured Northern Alliance, said in a Kabul news conference Sunday that Al Qaeda members would be handed over to the United Nations.

"Our view is that we are dealing with the Arabs on a humanitarian and Islamic basis. They should not have concern," Rabbani said.

But alliance commanders entering Kunduz said captured foreigners would be tried in Islamic courts, and other commanders in recent days promised no mercy for the foreigners.

It was unclear what kind of arrangement Gen. Dostum had made with the militants who later staged the prison revolt.

The Associated Press contributed to this report