* French president mobbed by grateful, cheering Malians
* Hollande says Islamist rebels hurt, but not yet defeated
* Visits ancient Timbuktu mosque and ransacked text library
* Operation now targets rebels hiding in mountain hideouts
Cheering, grateful Malians mobbed French President Francois Hollande on Saturday as he visited French troops fighting Islamist jihadist rebels, and he pledged France would finish the job of restoring government control in the Sahel state.
In a one-day trip to Mali accompanied by his ministers for defence, foreign affairs and development, Hollande was hailed as a liberator in the ancient northern city of Timbuktu, which French and Malian forces retook from the rebels six days ago.
He also received a rapturous reception in the capital Bamako, where he said the Islamist fighters allied to al Qaeda had suffered heavy losses in a three-week-old French intervention that he ordered last month at Mali's request.
Although the insurgents have been driven from Mali's main northern towns, Hollande cautioned that the task of France's military operation in Mali, codenamed Serval (Wildcat) and involving 3,500 soldiers on the ground, was not yet over.
"There is still a whole part of the north that remains unconquered ... There are terrorist elements concentrated in some areas of the country, others who are dispersed. There are risks of terrorism. So, we have not yet finished our mission," he told a news conference at the French ambassador's residence.
He added France would withdraw its troops from Mali once the West African country had restored sovereignty over all its national territory and a U.N.-backed African military force, which is being deployed, could take over from the French.
"We do not foresee staying indefinitely," he said, but he spelled out no specific time frame for the French mission.
Mali's interim President Dioncounda Traore thanked "our brother" Hollande for launching the French intervention. It has cost the life of only one French serviceman so far and has driven the rebels into the mountains of northeast Mali.
"Together we will hunt the terrorists down to their last hiding place," Traore said.
In Timbuktu, several thousand local residents in colourful robes and wraps sang and danced, shouting "Thank you, France" and "Papa Hollande". In Bamako, there were similar scenes, with thousands cheering Hollande and waving French flags.
"Vive Hollande, Vive la France," said one Bamako resident, Sidibe Lisa Camara. "Hollande our Saviour!" read one banner.
The United States and the European Union are backing the Mali intervention as a counter strike against the threat of Islamist jihadists using the inhospitable and ungoverned Malian Sahara as a launch pad for international attacks.
They are providing training, logistical and intelligence support, but have ruled out sending their own ground troops.
TIMBUKTU TO "SHINE" AGAIN
In Timbuktu, the Saharan trading town and seat of Islamic learning that spent 10 months under rebel occupation, Hollande visited the Djingarei-ber Mosque and the Ahmed Baba Institute, a library of ancient manuscripts that was ransacked by the rebels.
Hollande said it was essential that Timbuktu, a UNESCO World Heritage site, should be properly protected so that it could "shine" as a cultural treasure for the world.
Heavily armed French soldiers in armoured vehicles and Malian troops protected the French leader as he visited the mosque, which was built from mud bricks and wood in 1325.
"We have got our old lives back," said Khalifa Cisse, the muezzin or crier who calls the faithful to prayer at the mosque.
Hollande has repeated that the French operation, where the ground forces are backed by warplanes, helicopters and armoured vehicles, aims to make way eventually for the larger multi-national African force, which is still being put in place.
Drawn mostly from Mali's West African neighbours, this force is expected to number more than 8,000. But its deployment has been badly hampered by shortages of kit and airlift capacity and questions about who will fund the estimated $1 billion cost.
France's role in Mali has raised fears of reprisal attacks by Islamist radicals against French and other Westerners.
A Frenchman was among four people killed in Senegal's southern Casamance region on Friday when suspected separatists clashed with troops, but the incident did not appear to be linked to Mali.
UNVEILED WOMEN DANCE WITH JOY
The international community has greeted the liberation of Timbuktu with relief. It is a centre of Islamic scholarship in the tolerant Sufi tradition, but the radical Islamist occupiers smashed ancient Sufi mausoleums, calling them idolatrous.
The rebels also destroyed up to 2,000 of some 300,000 priceless ancient manuscripts held in the city. Experts say the bulk of the texts are secure and safe, however.
Timbuktu residents rejoiced at being freed from the severe version of sharia (Islamic law) imposed by the rebels, who had forced women to go veiled and inflicted beatings and amputations. Hollande said Mali's courts and the International Criminal Court should try those responsible for war crimes.
"These so-called Islamists did nothing but evil to us, they beat people, they cut off limbs," said Lala Toure, a woman who went unveiled and wore a short-sleeved white T-shirt with the printed words "Thank you France for your help".
Cisse, the muezzin, said the rebels, grouped in a loose alliance that includes al Qaeda's North African wing AQIM, had tried to impose an unfamiliar radical form of Islam on Mali.
French air strikes have forced the rebel fighters to retreat into the remote Adrar des Ifoghas mountains near the Algerian border. Hollande said this was where the rebels were holding seven French hostages previously seized in the Sahel.
He called on the jihadists to release the hostages and said everything was being done to obtain their freedom.
The next stage of the fight against the rebels, in a harsh Saharan battleground, could test the French and Malian forces and their African and other allies.