Richard Carapaz of EF Education-EasyPost climbed solo to victory on stage 17 of the Tour de France, a 178km ride from Saint-Paul-Trois-chateaux to Superdevoluy on Wednesday.

Carapaz, who has also won stages on the Giro d'Italia and Vuelta a Espana, finished 37 seconds ahead of Jayco Alula's Simon Yates to claim his first win on the Tour de France, with Movistar's Enric Mas third, nearly a minute behind.

The 31-year-old Carapaz also became the first Ecuadorian to win a stage at the Tour.

“This means everything to me. We have been trying it since the beginning. This was our first goal - to get a stage win,“ Carapaz said.

“Today was so difficult with attack after attack until eventually there was a big group. It’s going to be a day I will remember for my life.

“I had to wait for the right moment and made the most of it. We studied the course this morning with our sports director and I knew what I had to do. It’s a great victory.”

His attack in the mountains, about 13km from the finish, helped the Olympic champion breeze to victory but there was a battle in the general classification behind him as Slovenia's Tadej Pogacar retained his yellow jersey.

Pogacar attacked towards the end of the stage, forcing rivals Jonas Vingegaard and Remco Evenepoel to respond.

Evenepoel, who is third in the overall standings, attacked on the climb to pull ahead of Pogacar and second-placed Jonas Vingegaard to cross the line first among the contenders.

Pogacar, meanwhile, waited for the right opportunity and attacked in the final 300 metres to extend his lead by two more seconds in the general classification.

“I don’t even know myself why I tried today, but I got two more seconds ahead of Jonas and I’m happy with that,“ Pogacar said.

“Remco did a super good attack but we had super teamwork today.”

Earlier, Biniam Girmay came fifth in the intermediate sprint but held on to the green jersey when he beat Belgian Jasper Philipsen to the line, narrowly extending his lead in the standings to 33 points.

Girmay crashed with less than 2km to the finish in Tuesday's stage 16 which allowed Philipsen to comfortably sprint to victory but the Eritrean will now keep the green jersey a little longer. (Reporting by Rohith Nair in Bengaluru; Editing by Hugh Lawson, Christian Radnedge and Toby Davis)