N'DJAMENA, Chad — Thousands of people fled Chad's capital Monday as government troops and rebels battled for a third day. Gunfire and explosions were heard throughout the city, a U.N. official said.

The U.N. Security Council condemned the rebel offensive and authorized France and other nations to send troops to help defend President Idriss Deby's government.

Casualties were believed to be high, and the violence threatened peacekeeping and aid operations intended to stabilize a wide swath of Africa that borders the war-ravaged Darfur region of Sudan.

"Fighting and shelling has started again in N'Djamena," said Helene Caux, a spokeswoman for the U.N. refugee agency. Speaking from Geneva, she said U.N. staff in Chad told her it was impossible to move around the city.

Earlier, officials said the rebels had withdrawn from the capital of the oil-rich country overnight after fierce resistance from government forces backed by helicopter gunships and tanks.

The rebels arrived on the city's outskirts Friday after a three-day push across the desert from Chad's eastern border with Sudan. Riding on 250 pickup trucks mounted with machine guns, between 1,000 and 1,500 insurgents entered the city early Saturday, quickly spreading through the streets and reportedly trapping Deby in the presidential palace.

But by Sunday, government forces were strafing rebel positions with helicopter gunships and bombarding them with tanks.

"The Chadian army fought very vigorously and continuously regained ground around the presidential palace until yesterday afternoon when the rebels announced they were leaving the city," a French military spokesman, Capt. Christophe Prazuck, said earlier Monday.

"The fighting was heavy, the weapons used were heavy," he said. "Probably many people were injured or killed."

Rebel spokesman Abderaman Koulamallah said the insurgents had only pulled back "to give the population a chance to get out," leaving open the possibility of a renewed offensive.

Speaking by satellite telephone, he told The Associated Press that the rebels controlled the two strategic bridges straddling the Chari River on the eastern side of the city.

But the government said it had control of the city.

"The whole of N'djamena is under control and the savage mercenaries are routed," Interior Minister Ahmat Mahamat Bachir told Radio France Internationale.

Government forces would be ready if the rebels launched another assault, he said. "They will find us in their path, even if there are 1,000 columns."

The city was chaotic, said Christophe Droeven, head of Catholic Relief Services who was evacuated Sunday.

"This is a real battle," he said by telephone from Paris. "We saw burnt tanks, burned out cars, people stealing vehicles, some people looting houses, people running with TVs on their heads."

Hundreds of people, most of them believed to be civilians, had been wounded, said Isabelle Defourny, head of Chad operations for the French group Doctors Without Borders. Tens of thousands of people were fleeing the capital, the organization said.

At U.N. headquarters in New York, the Security Council called "upon member states to provide support, in conformity with the United Nations Charter, as requested by the government of Chad."

French Ambassador Jean-Maurice Ripert said he could not say yet whether France would send more troops to bolster Deby's government.

France, the former colonial power, already has 1,400 soldiers in Chad. They were helping evacuate hundreds of foreigners from the country.

Since the outset of the fighting, Chadian officials have repeatedly accused Sudan of backing the rebels. An aide to French President Nicolas Sarkozy said Sunday that Sudan wanted to crush Deby's regime to keep the European Union from the imminent deployment of a peacekeeping force that is to operate along Chad's volatile border with Darfur.

"Why did the intervention happen now?" Sarkozy's top aide, Claude Gueant, asked on Europe-1 radio. "It was the last moment — before the arrival of EUFOR, which was starting to be put in place — for Sudan to reach its goal, to try to liquidate the regime of Idriss Deby."

At the height of the fighting, France offered to take Deby out of Chad. But the president, who came to power as the head of a rebel force that seized N'Djamena in 1990, apparently turned down the offer.

The U.N. peacekeeping force, which has put its deployment on hold until the situation in Chad becomes clearer, was to be based in the area around the eastern town of Adre. Rebels said Sunday they had seized the town. But the government said it repulsed the attack.

Adre, near the Darfur border, is a humanitarian hub surrounded by camps with about 420,000 refugees from Darfur and Chadians displaced in the spillover from the violence.

Chadian Gen. Mahamat Ali Abdallah Nassour charged Sudanese troops were involved in the attack on Adre and called it a "declaration of war."

Chad's Foreign Minister Amad Allam-Mi said on RFI: "Sudan does not want this force because it would open a window on the genocide in Darfur."

Sudan has repeatedly denied any involvement.

"We would like to stress that Sudan does not provide any assistance to any side" in Chad, Sudan's Foreign Ministry spokesman Ali al-Sadeq said in a statement Sunday. "Any developments in Chad reflect on Sudan and any instability there would have a negative impact on Sudan."

Associated Press writers John Leicester in Paris, Alexander G. Higgins in Geneva, Alfred de Montesquiou in Khartoum, Sudan, Matthew Rosenberg in Nairobi, Kenya, and John Heilprin in New York contributed to this report.