By Julien Pretot

ARCALIS, Andorra (Reuters) - Tom Dumoulin of the Netherlands attacked near the foot of the final climb to win the ninth stage of the Tour de France in extreme weather conditions as Alberto Contador pulled out of the race on Sunday.

Giant Alpecin rider Dumoulin, sixth in last year's Vuelta, was the strongest of the day’s breakaway riders, taking a solo victory in a deafening hailstorm after riding most of the day in temperatures nearing 40 degrees Celsius.

The Dutchman completed his set of grand tour stage wins after prevailing in the Vuelta and the Giro d'Italia.

Briton Chris Froome retained the overall leader’s yellow jersey after controlling his closest rivals in the ascent to Arcalis, a 10.1km effort at an average gradient of 7.2 percent.

The Team Sky rider leads compatriot Adam Yates (Orica-Bike Exchange) by 16 seconds and Ireland's Dan Martin (Etixx-Quick Step) by 19.

"It's still a very open race at this point, I'm really happy to come into the first rest day as leader," he said.

"There were a lot of attacks in that final climb, I was hoping to gain more time as well. I just made sure to close any gaps and at least finish in the same time as my rivals today."

Contador, who had crashed on the two opening stages and had a fever in the morning, called it quits 104km from the finish line after trying his luck one last time with a vintage early move.

"I have not recovered from the crashes, I've been sick overnight, that's why I made this decision. I could not continue," said the Spaniard.

Other top favorites had a tough time with Alejandro Valverde (Movistar), Italian Fabio Aru (Astana) and American Tejay van Garderen (BMC) losing ground in the ultimate climb of the first summit finish of the Tour.

Overall, Froome, who made a few brief attacks in the finale, could not distance himself from last year's runner-up Nairo Quintana (Movistar), who rode conservatively, keeping his cards close to his chest.

The Colombian is fourth overall, 23 seconds behind Froome.

Froome’s former team mate Richie Porte (BMC) of Australia, Yates and Martin also managed to hang on to the defending champion’s wheel.

Frenchman Thibaut Pinot, who lost all hope of a decent overall finish in Paris in the first Pyrenean stage, snatched the polka dot jersey for the best climber with a strong ride in the breakaway.

Contador and Valverde launched an old school attack early on, pulling away from the pack and catching a big group of breakaway riders on the climb to the Port de la Bonaigua.

Both were seen as threats to Froome and Team Sky upped the pace before the second ascent of the day to the Port del Canto. "My team mates did not panic and I think I owe it to them to still be in yellow today," said Froome.

Valverde dropped off as the breakaway group’s lead, which had risen to two minutes, was under one minute.

He slid back into the peloton as Contador, who had been distanced earlier, was struggling, rolling down to his team car four times before getting off his bike for good.

Monday is a rest day on the Tour.

(editing by Ken Ferris/Rex Gowar)