Poland's Rafal Majka has won the 17th stage of the Tour de France in a late breakaway on the last of four tough climbs in the Pyrenees.

Vincenzo Nibali trailed by about a minute and gained key seconds on his main rivals as he retained the leader's yellow jersey that he's worn for all but two stages this year.

It was Majka's second stage win, having also won Stage 14.

Wednesday's 124.5-kilometer (77-mile) trek was the shortest stage in this year's Tour, and the second of three days in the mountains straddling the French and Spanish borders.

It covered three hard Category 1 ascents from Saint-Gaudens and a final push up to Pla d'Adet ski station above the town of Saint-Lary-Soulan.

More From ESPN Western Colorado