MULHOUSE, France — German rider Tony Martin showed he has climbing skills to go with his speed by easily winning the hilly ninth stage of the Tour de France on Sunday, while Frenchman Tony Gallopin took the yellow jersey from Vincenzo Nibali of Italy.

The 29-year-old German, a three-time world time-trial champion, broke away with specialist climber Alessandro De Marchi of Italy and eventually won by nearly three minutes.

“The objective was to win the stage. There was a chance to do it and I felt good, my legs felt good,” Martin said. “I knew it would be one of my rare chances to win a stage.”

The 170-kilometer (105.4-mile) trek from Gerardmer to Mulhouse — in the midsize Vosges mountain range near the German border — featured six mostly moderate uphill treks that posed Martin little problem, even though he is not a reputed climber.

Save 75% on a Digital Subscription Today

“When the stage started to climb I realized I was stronger and started to attack and then things went well,” he said. “We’re close to Germany, and that was an extra incentive.”

Martin clocked a winning time of 4 hours, 10 minutes. Swiss rider Fabian Cancellara was second and Belgian rider Greg Van Avermaet was third — both 2 minutes, 45 seconds adrift in the chasing pack.

It was a good day for France with Gallopin set to defend the yellow jersey on Monday — Bastille Day.

Gallopin, 26, did enough to erase his deficit of more than three minutes to Nibali and leads him by 1:34.

“It’s with great pride that I will ride on the national holiday day in the yellow jersey,” Gallopin said.

The last Frenchman to wear the yellow jersey was Thomas Voeckler in 2011. He also wore it in 2004 — the year disgraced cyclist Lance Armstrong won the sixth of seven Tour wins, before later being stripped of all of his titles for doping.

Two-time champion Alberto Contador finished safely in the main pack along with Nibali — both were nearly eight minutes adrift of Martin — and is 4:08 back down in ninth place overall.

They will resume their contest in the toughest stage so far — Monday’s 161.5-kilometer (100-mile) trek from Mulhouse to La Planche des Belles Filles that features three step Category 1 climbs — before a rest day Tuesday.

“We’ll have to decide whether or not we try to attack or ride defensively,” Contador said. “It was a tough day.”