* Fire spread over 5,000 hectares - official
* Firefighting planes deployed over tourist area
* Some 100 homes destroyed
* Macron says worst has been avoided (Adds Macron's visit to the area, fires in southwestern France)
By Eric Gaillard
GRIMAUD, France, Aug 17 (Reuters) - French firefighters hampered by strong winds were battling to contain a wildfire in the hills behind the coastal town of Saint-Tropez on Tuesday as campsites packed with holidaymakers were evacuated.
Around 900 firefighters and planes carrying water were tackling the fire but it was still not under control nearly a day after it began at a highway service area, authorities said. They urged those evacuated not to try to return to their homes.
French President Emmanuel Macron left his nearby summer retreat to thank the firefighters for their efforts.
"The worst has been avoided, we must remain humble in the face of these events (...) Climate disturbances will lead to more such fires," he said, adding that France had been less badly affected than some other countries in southern Europe.
Waves of extreme heat have hit much of the Mediterranean region in recent weeks, with wildfires from Spain and Greece to Turkey raising uncomfortable questions over global warming and countries' preparedness.
The French fire, which hit several villages in the southern Var region, spread quickly overnight into Tuesday as high winds propelled the blaze across 5,000 hectares (12,350 acres) of land, burning through some 3,500 so far.
"We were completely surrounded by the flames," said Stephane Gady, mayor of the village of La Mole, which is nestled near pine forests close to the French Riviera.
No lives were lost in the area, Gady and local authorities in the Var said, but around 100 homes were destroyed. A campsite in Grimaud was razed to the ground. Charred mobile homes were scattered across the site.
At least six other campsites in the Var region were evacuated, the Var prefect's office said.
Another local mayor, Philippe Leonelli, said his seaside town of Cavalaire was spared, and was now sheltering some 2,000 people from nearby campsites in gyms and events halls.
"This time the fire spread in three hours through an area that would normally be covered in 48. It's crazy, that's how quickly it all went," Leonelli said, adding several colleagues had lost their homes.
Cavalaire is normally home to some 10,000 people, but the population swells to 90,000 during the summer months. The villages of La Croix Valmer and Grimaud were also hit.
Alexandre Jouassard, an emergency services spokesman, said some locals were being told to stay indoors with wet sheets under the door instead of fleeing to prevent road chaos in the area, known for its beaches and coastal resorts.
Fires also broke out in two villages in southwestern France, fuelled by gusts of wind, the Aude department prefect said, prompting the deployment of water-carrying planes and more than 500 firefighters, five of whom sustained injuries, one badly. (Reporting by Eric Gaillard, Sarah White, Richard Lough, Sudip Kar-Gupta, Myriam Rivet, Juliette Portala and Benoit Van Overstraeten, Editing by John Stonestreet, Andrew Cawthorne and Gareth Jones)
Our Standards: The Thomson Reuters Trust Principles.