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 105.4-mile trek from Gerardmer to Mulhouse -- in the midsized 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.

"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."

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 -- and for Germany, which won World Cup final against Argentina.

Martin clocked a winning time of 4 hours, 10 minutes.

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

Portuguese rider Tiago Machado is in third place overall, 4:08 back. But, like Gallopin, he is not considered a Tour contender.

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 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."

The Tour has paid tribute to those who died in the First World War -- 1914-18 -- by riding along the battlefields where millions died.

Sunday's route took the peloton past the historical landmark where the Bataille du Linge was held in 1915 as some 17,000 French and German soldiers fell in three months of ferocious fighting.

Shortly before the day's most difficult climb -- a Category 1 ascent of 6.7 miles up Le Markstein -- Martin broke away, and Gallopin's chasing group was about two minutes behind him and Nibali more than six minutes adrift.

Martin was no threat to Nibali's yellow jersey, but Gallopin was.