Sunweb’s Tom Dumoulin has retained the pink jersey, albeit with a significantly reduced advantage, after an extraordinary and controversial stage 16 of the Giro d’Italia, eventually won by the home rider Vincenzo Nibali.

Dumoulin was left by the Movistar team after their riders joined in an attack while the pink jersey holder briefly left the course and made for a roadside ditch for a comfort break. The incident left observers debating whether riders failed to observe the sport’s “unwritten rules”, as competitors would traditionally not attack the overall leader in such circumstances.

Following Monday’s rest day the 222km stage from Rovetta and Bormio, taking in a double ascent of the Stelvio, offered stunning scenery but gruelling riding. After his break 33km from the finish, caused by what was described as “stomach problems” by his team, Dumoulin struggled up the Umbrail Pass, the third major climb of the stage. Yet with his overall lead over Movistar’s Nairo Quintana threatening to evaporate completely, he rallied to claw back time. He now leads the Colombian by 31sec, down from 2min 41sec when the day began.

Facebook Twitter Pinterest Sunweb’s Tom Dumoulin, in the pink jersey, climbs the Mortirolo during the gruelling stage 16 of the Giro d’Italia. Photograph: Luk Benies/AFP/Getty Images

The Dutchman told Eurosport: “I just had some problems and needed a dump, I could not hold it any more. It was after the first time on Stelvio, I started to feel it in the downhill and I just had to stop, it was not possible to continue any more.”

He felt he should have been given an opportunity to close back on the peleton once he was able to continue after his unplanned toilet stop.

Dumoulin added: “I decided to fight and fight, and then take conclusions after the finish, that is what I did, and I think that is good but I am very disappointment with the day, of course. I was with the strongest today. I could have easily been with Nibali and Quintana, I just lost it because I had a problem. That’s shit.”

After a two-man sprint the stage was won by Bahrain-Merida’s Nibali, who started the day fourth in the GC, by less than a wheel from Team Sky’s Mikel Landa, with Quintana 12sec back. Nibali, with Italy’s first success of the 2017 race, moved into third overall, 1min 12sec off the lead. Landa took over as King of the Mountains.

Of his victory, Nibali said: “I didn’t think about being the first Italian to win a stage; what counted was having a strong team, making a big effort and staying up there. I am closer now but Dumoulin has the advantage of the time trial in Milan.”

Earlier in the Queen stage, Astana’s Luis León Sánchez was first over the opening climb of the day on the Passo del Mortirolo, appearing to be allowed to take the 1,764m category 1 climb which was named in honour of his team-mate Michele Scarponi following his death last month in a training accident. Britain’s Adam Yates, riding for Orica, sits 10th in the general classification.

Wednesday’s 17th stage will run over 219km from Tirano to Canazei.

Eurosport UK (@Eurosport_UK) When you've gotta go... you've gotta go... Natural break woe for Tom Dumoulin in stage 16 of the #Giro100 pic.twitter.com/IPP7AJQP15

Stage 16 results (Rovetta-Bormio, 222km)

1 Vincenzo Nibali (Bahrain-Merida) 6hr 24min 22sec 2 Mikel Landa (Team Sky) ST 3 Nairo Quintana (Movistar) +12sec 4 Domenico Pozzovivo (AG2R) +24sec 5 Ilnur Zakarin (Katusha) +34sec 6 Davide Formolo (Cannondale) +1min 26sec 7 Bauke Mollema (Trek) +1:35 8 Bob Jungels (Quick-Step) 9 Adam Yates (Orica) +1:35 10 Thibaut Pinot (FDJ) +1:35

General classification

1 Tom Dumoulin (Sunweb) 70hr 14min 48sec 2 Nairo Quintana (Movistar) +31sec 3 Vincenzo Nibali (Bahrain) +1:12 4 Thibaut Pinot (FDJ) +2:38 5 Ilnur Zakarin (Katusha) +2:40 6 Domenico Pozzovivo (AG2R) +3:05 7 Bauke Mollema (Trek) +3:49 8 Bob Jungels (Quick-Step) +4:35 9 Steven Kruijswijk (LottoNL) +6:20 10 Adam Yates (Orica) +7:00