PANAMA CITY, DEC. 6 -- American troops were dispatched to surround Panamanian police headquarters early Wednesday because a handful of U.S. advisers, including two Army colonels, were trapped inside and on the verge of a shootout with mutinous Panamanian police officers who had stormed the building, American officials said here today.

The advisers had been inside the headquarters shortly after midnight when the rebellious officers burst in and took control of the building.

"There were about 50 heavily armed people with Rambo-like uniforms and gas masks," Col. James Steele, head of the U.S. Military Support Group here and an adviser to the government, said in an interview. "They said throw down your weapons and we said, 'Expletive deleted.' "

In the standoff, the marauding police officers threw a tear-gas canister at the Americans, said Steele. The situation became so tense that he radioed his commander, Brig. Gen. William Hartzog of Joint Task Force Panama, for help.

"I said we are on the verge of a shootout here," said Steele. "I said we are considerably outnumbered."

U.S. military police were sent almost immediately to surround the police headquarters. U.S. diplomats said, nevertheless, that Panamanian officials were consulted and they assented before the troops rushed to the scene.

The rebels were led by a former police chief, retired colonel Eduardo Herrera Hassan, who was arrested and jailed in October for plotting against the Panamanian government.

Herrera had made a helicopter escape from an island prison seven hours before he arrived at the police headquarters, which was his office until he was forced to retire in August.

Steele, Col. Jack Pryor and the other U.S. soldiers were helping to coordinate the manhunt for Herrera when the former police chief arrived with dozens of well-armed men.

In the half-hour standoff, said the Americans, both sides held their fire. The rebel police said they did not want to harm the Americans, and they allowed the U.S. side to leave at about 4 a.m.

Later Wednesday morning, Herrera and more than 100 men began a march on the National Assembly that appeared designed to topple the government. They were halted and disarmed by U.S. troops.