French President Francois Hollande flew into Central African Republic on Tuesday — hours after two if his country's soldiers were killed in fighting — and praised troops for tackling "horrendous violence" against women and children and helping avert a slide into civil war.

Hollande ordered a 1,600-strong French force into its former colony last week with United Nations backing to disarm Muslim and Christian militias and halt fighting that was spilling over into killing of civilians.

Fighting continued on Tuesday as crowds attacked a mosque, looted houses and torched cars in the capital, Bangui.

The French force suffered its first casualties overnight, when two soldiers were killed in clashes with unidentified gunmen.

The medical charity Médecins Sans Frontières said 72 people had been treated in two Bangui hospitals, mainly for  gunshot wounds.

Several lynchings were reported by residents, adding to the toll of 465 killed since Thursday.

After landing at Bangui airport, a solemn Hollande walked across the runway to a large tent, where he paid homage at the coffins of the two French soldiers draped with the French flag.

"For weeks, massacres have been perpetrated; there has been horrendous violence against women and children," he told assembled troops.

"The clashes that were taking place and which are ongoing are taking on a religious dimension with the risk of ending in a civil war. Your goal is to disarm the militias and the groups, to restrict them and to avoid clashes.

Mandela memorial

"It's a risky task, and the death of Antoine Le Quinio and Nicolas Vokaer is a painful reminder of that. There is danger everywhere."

Hollande was making a stopover in CAR on his way back from a ceremony to pay last respects to late Nelson Mandela in South Africa.

The country has been gripped by chaos since mainly Muslim Seleka rebels seized power in March.

Months of looting, raping and killing since has brought reprisals by Christian militias and allies of ousted President Francois Bozize.

Michel Djotodia, a rebel leader-turned interim president, has largely lost control of his loose band of fighters, which includes many gunmen from Sudan and Chad.

Diamonds, gold, uranium

Christians fled reprisals by Seleka gunmen following a failed offensive on Bangui last week but the French move to disarm all fighters has subsequently weakened Seleka's influence in the capital, leading to counter-attacks.

Central African Republic is rich in diamonds, gold and uranium, but despite such resources, most people remain poor. The country has seen little stability in five decades, and France has intervened more times since independence in 1960 than in any of its former colonies.

"What is most difficult to achieve is not to put an end to a conflict or even topple a dictatorship," Hollande said in his address to the troops.

"No. What is most difficult to do is to reconcile a people which has been torn apart. That is your mission and we need to succeed in this mission —succeed for the future of Central African Republic, succeed for France's honour, succeed for the memory of Antoine Le Quinio and Nicolas Vokaer."

Central African Republic also lies at a crossroads of conflict in the heart of Africa, with Sudan, South Sudan and Somalia to the east, the Islamist threat in the Sahel region to the northwest and the revolts of the Great Lakes to the southeast.

Peacekeepers struggle

The UN refugee agency UNHCR said about 100,000 people had fled their homes in Bangui in the past few days, bringing to more than half a million the number of displaced countrywide since the crisis began a year ago.

French soldiers have also been deployed to other towns across the country, where a 2,500-strong regional African peacekeeping force has struggled to stamp its authority.

During Hollande's brief stop, he was also due to meet Djotodia, French and African peacekeepers and religious leaders before flying back to France late on Tuesday.

Hollande has accused Djotodia of not doing enough to curb the violence.