The UN Security Council has condemned a rebel attack on the capital of Chad on Thursday, which the government says it has now beaten off.
After about two hours of fighting around dawn, President Idriss Deby said government troops were in full control.
Chad accuses Sudan of supporting and arming the attackers while Sudan says Chad backs rebels in its Darfur region.
The UN Security Council urged both nations to resolve differences through talks and not support hostile actions.
The council "condemned any attempt to seize power by force... and calls on the rebels to put an end to violence and to participate in the democratic process".
UN Secretary General Kofi Annan said he was "greatly troubled by the worsening security situation in Chad".
A BBC correspondent in N'Djamena said gunfire and shelling began at dawn.
Mr Deby said a small rebel column attempted to enter the capital but was "completely destroyed".
Correspondent Stephanie Hancock told the BBC News website that government forces had piled bodies of what they said were United Force for Change rebels on the front steps of the National Assembly.
Many more had been rounded up and were being guarded by troops.
Foreigners were rushed to muster points in the city from where they could be evacuated. French troops took up positions in the capital.
Mr Deby said elections scheduled for early next month would go ahead as planned.
The rebels have vowed to overthrow Mr Deby before the polls, which the opposition are boycotting.
The rebels accuse Mr Deby of being a dictator and say they want to organise a national forum that will lead to a transitional government and then democratic elections.
A spokesman for the rebels told the BBC they had not been defeated and would attack N'Djamena again.
Jean-Marc de la Sabliere, the UN envoy of France, which has about 1,200 troops in its former colony, said the rebels came from Sudan's Darfur region.
Chad, which is rich in oil, has been hit by the conflict in Darfur, with hundreds of thousands of refugees fleeing across the border.
Mr Deby's government blames Sudan for inspiring the uprising - an accusation Sudan denies. Sudan accuses Mr Deby of supporting Sudanese rebels in Darfur who belong to his ethnic group, reports BBC news.
"There should be no Russian who goes to sleep without wondering if they're going to get their throat slit in the middle of the night,” Milley said