Loyalist troops put down an uprising by security forces who attacked military and police bases across the Ivory Coast Thursday, trying to oust the president while he was visiting Italy. The Cabinet minister in charge of police was killed along with the former junta leader accused of having a role in the uprising.

President Laurent Gbagbo declared the rebellion had been halted after hours of heavy gunfights and mortar exchanges left at least 10 rebel soldiers and seven loyal police dead. Bloody bodies littered the streets of Abidjan, the commercial capital.

Gbagbo's government has been struggling to calm ethnic and political tension and a restive military since the once-tranquil country's first-ever coup in 1999.

Government troops killed Gen. Robert Guei, the ex-junta leader, when his car refused to stop for a roadblock in downtown Abidjan, paramilitary police Sgt. Ahossi Aime said.

Guei, the former army chief who took power in the 1999 uprising, was forced out during elections the next year amid allegations he was trying to steal the vote.

Interior Minister Emile Boga Doudou apparently was killed in a rebel attack on his residence in which two guards were injured, police said.

In Rome, presidential aide Toussaint Alain said it was evident the former junta chief had played a role in the coup attempt. "Do you think Guei was on the battlefield going shopping?" Alain asked.

Defense Minister Lida Moise Kouassi announced the coup had collapsed in a television broadcast.

"I can assure you that since 6 o'clock this morning the army has taken everything into control," Kouassi said.

Until his midafternoon broadcast, both radio and television had been off the air during the fighting.

"Loyalist forces have come out on top," President Laurent Gbagbo said in a statement from Rome, where he announced he was cutting short his visit.

Kouassi said Ivory Coast's armed forces had mobilized nationwide to put down the insurrection, which he said was quelled "except for pockets of resistance" in the cities of Bouake and Khorogo.

Infrastructure Minister Patrick Achy said he believed the country's sports minister might still be in the hands of insurgents at Bouake.

While members of the military were believed to be involved in Thursday's uprising, it was not clear how many troops took part or what branch of the armed forces rebelled. Diplomats had said early in the uprising that as many as 800 soldiers revolted.

Insurgents launched their attacks about 3 a.m., striking homes of the president and ministers of the interior and of defense, military barracks, and other sites across Abidjan.

Attacks were reported at about the same time in at least three northern and central cities and towns. There were no reports of violence in Yamoussoukro, the titular capital.

The uprising erupted with bursts of automatic-weapons fire outside a paramilitary police base in Abidjan. About 15 gunmen broke into the compound, killing six paramilitary police officers, a surviving officer said from within the base.

Gunfire and repeated, heavy explosions spread to other parts of the city, including downtown and suburbs. One rocket hit an anti-riot police post, injuring two officers.

Guei, the former junta leader, was killed when loyalist paramilitary police opened fire on his vehicle in downtown Abidjan after the driver refused to stop at a checkpoint, paramilitary police Sgt. Ahossi Aime said.

Guei died at the scene, Aime said. In Rome, Alain said it was evident Guei had played a role in the coup attempt. "Do you think Guei was on the battlefield going shopping?" he asked.

The ex-junta leader's body lay in a morgue after the uprising, with a single bullet hole in the head.

Outside Abidjan, young men in civilian clothes battled with soldiers cornered inside a military base in the northern city of Korhogo, an opposition stronghold.

The attackers displayed two bodies they said were a civilian shot in the cross fire and a paramilitary policeman.

Gunmen also attacked an air base in the central town of Bouake and an army base in the northern town of Fereke, a senior army commander said. The military commander in Bouake was killed in the fighting, military officials said. Residents of the central town of Daloa also reported heavy gunfire.

Ivory Coast authorities closed the international airport in Abidjan, and imposed a 6 p.m. to 8 a.m. curfew through Tuesday. Most streets were deserted Thursday afternoon ahead of the curfew, with only soldiers on patrol. Schools and many businesses closed.

Witnesses said soldiers early on were shooting at motorists who approached roadblocks.

The U.S. and other Western embassies stayed shuttered for the day, and urged their nationals to stay indoors.

Ivory Coast's standing as one of West Africa's most stable and prosperous nations shattered with the Dec. 24, 1999, coup. The takeover ushered in three years of military uprisings and political and ethnic violence, killing hundreds. The government has heavily armed the police and military in a bid to enforce order.