Dan Martin admitted he was lucky to have avoided serious injury after he came off his bike in a heavy fall that ended Richie Porte's Tour de France on a chaotic stage nine.

Porte, seen as one of the main contenders for the yellow jersey, misjudged a turn on the descent of the Mont du Chat - the last of seven categorised climbs on a brutal stage - taking out Martin and throwing both riders in the rock face at the side of the road.

Porte was taken away in an ambulance, but Martin got on his bike and made it to the finish, though he lost valuable seconds to leader Chris Froom.

"After I crashed the second time, I was flying on the downhill and caught the group in front and we rode as hard as we could all together, it was a team trial to limit our losses," a brusied and bloodied Martin said after returning to the paddock with a broken helmet.

"It was just a case of get to the finish. I went from sitting pretty and content, having the job done almost, to... yeah.

"Richie lost it on one corner - it was so slippery, I guess the organisers got what they wanted," he said. "It was so slippery under the trees.

"I was very, very lucky to get away as lightly as I did."

Rigoberto Uran won a dramatic stage while Chris Froome came home third to retain the yellow jersey.

Cannondale-Drapac's Uran took victory in a photo finish ahead of Warren Barguil of Team Sunweb - one final twist of drama on a day that will live long in Tour history.

Martin (Quick-Step Floors) came down again later in the descent, but battled on to the finish, losing fourth place as he slipped to sixth, one minute and 44 seconds down, 18 seconds ahead of seventh-place Simon Yates of Orica-Scott.

Earlier, Team Sky's Geraint Thomas, who started the day in second overall, suffered a suspected broken collarbone in a crash on the damp descent of the Col de la Biche.

It all came down to a rare sprint finish between general classification contenders, with Uran coming out on top despite being stuck in a single gear after collecting debris as he dodged the Porte crash.

AG2R La Mondiale's Romain Bardet fourth and Fabio Aru of Astana fifth.

With four bonus seconds on the line for third place, Froome extended his lead over Aru to 18 seconds.

Bardet is up to third overall, 51 seconds down, four seconds ahead of former Team-Sky man Uran who catapulted up the standings with the win.

The crashes were not the only cause of drama.

Froome suffered a mechanical problem on the Mont du Chat, the last of three hors categorie climbs on the day, and as the three-time Tour winner was calling for the team car Aru attacked in a clear breach of cycling's protocol.

The other general classification contenders followed the Italian, but seemingly in order to remonstrate with him and tell him to wait.

Froome soon caught back up after a bike change but made his feelings known to Aru as he gave the Astana man a nudge after a corner.

Soon after that, two-time Tour winner Alberto Contador was dropped by the group of contenders, and Colombian Nairo Quintana soon followed, apparent confirmation that his bid to do the Giro d'Italia and Tour double have left him short of his best form.

Quintana would finish in the group that included Martin and Yates, one minute and 15 seconds behind Uran, while Contador shipped more than four minutes.

While Froome will be relieved to have safely completed a stage filled with hazards, the loss of Thomas could be hugely significant with Team Sky left weakened.

It was a fourth crash of the race for Thomas, who spent four days in the yellow jersey after winning the opening time trial in Dusseldorf last weekend.