Chris Froome retains yellow jersey as Peter Sagan claims Stage 16 honours in Berne
Peter Sagan won stage 16 of the Tour de France in a photo-finish ahead of Alexander Kristoff, while Chris Froome stayed safe in the yellow jersey.
World champion Sagan took his third stage victory of this Tour by a tiny margin at the end of a 209km stage from Moirans-en-Montagne to Berne.
Team Sky's Froome was in the leading pack as they crossed the line to ensure he keeps yellow heading into Tuesday's rest day.
Although this was a relatively flat stage ahead of the Alpine challenges to come, the tight technical finish in Berne - which included a sharp cobbled climb two kilometres from the finish - was thought to suit the likes of Sagan and so it proved
However, it was far from straightforward as sprint specialists Marcel Kittel and John Degenkolb survived that late climb alongside Sagan and Kristoff.
Katusha's Kristoff opened up the sprint first and the Norwegian looked to have all the advantage he needed, but Tinkoff's Sagan threw his bike forward at the line and snatched a win which all but ends the competition for the points leaders' green jersey.
Trek-Segafredo's Fabian Cancellara, the 35-year-old Berne native in his final Tour de France, had to settle for sixth place.
Froome crossed the line 13th, alongside his principle rivals for yellow on the same time as the leaders.
Etixx-QuickStep pair Julian Alaphilippe and Tony Martin had animated the day with a breakaway which lasted for 170km and saw them pull almost six minutes clear at one point.
Their advantage began to tick down as they approached the Swiss border, dipping under five minutes as they flew through the checkpoints.
As they approached the outskirts of Berne, Alaphilippe was caught first with Martin sitting up with a wave and a smile 22km from the finish.
Almost as soon as they were reeled in, Lampre-Merida's Rui Costa went clear and built a 15-second lead, but he was hoovered up just inside the 5km banner.
Ireland's Dan Martin remains in ninth place overall just over five minutes behind Froome.
Team Dimension Data had hoped to make an impression to repeat Steve Cummings' emotional Nelson Mandela Day victory of a year ago, but Edvald Boasson Hagen could not find space in the final sprint and came home ninth.
His team-mate Mark Cavendish, winner of four stages in this Tour, stayed with the final group on the cobbled climb but did not have the legs to engage in the sprint and rolled home in 22nd place.
The result leaves Froome one minute and 47 seconds clear in the yellow jersey, with Trek-Segafredo's Bauke Mollema second.
Briton Adam Yates of Orica-BikeExchange is third, two minutes and 45 seconds back and leading the young riders' classification, with Movistar's Nairo Quintana fourth, a further 14 seconds down.