Friday 27 September 2013 08.34 EDT
First published on Friday 27 September 2013 08.34 EDT

Brian Cookson was elected head of cycling's governing body, the UCI, on Friday by a dramatic throw of the dice after five hours of constitutional wrangling.

Having heard the delegates to the UCI Congress get increasingly frustrated over the question of whether the incumbent Pat McQuaid should be allowed to stand, Cookson stood up and said simply: "We've had enough of this. I'm going to propose we go straight to the vote between the two candidates."

The proposal was a lifeline to the Italian Renato Di Rocco, who was chairing the election debate in place of McQuaid and who had appeared to be on the point of calling for a vote over whether or not the Irish president's nomination was valid.

There was obvious unrest in the hall: one delegate, from Algeria, had just castigated the Congress as "a show, a masquerade, a lack of respect for everyone here today". Another had earlier been overheard outside the gents discussing "the politics of a banana republic".

The vote went decisively Cookson's way, with the margin of 24 delegates to 18 greater than had been expected, implying that there had been a swing away from McQuaid at the last minute. The British candidate looked every bit as surprised as his rival, standing up to declare "the real work starts now". After a bitter election process with new accusations of skulduggery emerging only a few hours earlier, Cookson called upon the cycling community "to unite and come together", before thanking McQuaid for his contribution and wishing the former president well "in whatever he goes on to do".

McQuaid, who had been in office since 2005, had pledged not to launch a legal challenge should he be defeated.

"My first priorities as president will be to make anti-doping procedures in cycling fully independent, sit together with key stakeholders in the sport and work with Wada [the World Anti-Doping Agency] to ensure a swift investigation into cycling's doping culture," said Cookson, who had earlier called for delegates to think of the millions of people who follow cycling, of their "doubt and shame" at what has gone on in the sport in recent years.

"Hallelujah," tweeted Lance Armstrong, no less, the man who sparked the cataclysmic doping crisis that led to the election. It was probably not an endorsement that Cookson would have wanted: the disgraced Tour de France winner's links with the UCI will be investigated under Cookson, whose entire pitch was based on the need for change, to boot out the old regime and bring in new faces.

Travis Tygart, the head of Usada, welcomed Cookson's win, adding that the UCI under McQuaid had done everything to thwart his investigation into Armstrong that finally led to his lifetime ban.

"Usada welcomes cycling's vote for a new and clean future," he said. "The outcome of the UCI election sends a powerful message that sport leaders who fail to fully protect the rights of clean athletes and the integrity of their sport will be held accountable.

"The UCI tried to obstruct our investigation into doping in cycling at every turn, and then after the release of our reasoned decision the previous leadership failed to take necessary and decisive action to fully clean up the sport.

"The election of a new UCI president who is committed to transparency and a new direction, is a monumental moment for the sport and demonstrates that when clean athletes stand up for their rights they will be heard.

"We are confident that as president, Mr Cookson will take the decisive action needed, so that cycling can truly unshackle itself from the past and pursue a clean culture for future generations of cyclists."

The backdrop of Florence's Palazzo Vecchio could hardly have been more appropriate given its links to the Medicis and Machiavelli, who could have been describing the Cookson gambit when he wrote: "All courses of action are risky, so prudence is not in avoiding danger – it's impossible – but calculating risk and acting decisively." .

The room chosen for the Congress, the Salone dei Cinquecento, is covered in frescoes by Vasari, and contains statues by Michelangelo. During the long morning, the two sides emerged: New Zealand, Australia, Russia – and the British delegate Charlie Jackson – speaking out against McQuaid's constitutional manoeuvres, while Asian, Caribbean, South American and African delegates backed the incumbent.

The juxtaposition of high art and low sports politics was surreal, so too the abrupt transitions from tedium to farce. The first curveball came when the head of the ethics commision, Peter Zevenbergen, attackedcriticised a letter sent by McQuaid to member federations attacking Cookson as anti-democratic, then, as if to ensure balance, detailed allegations from two days ago that the Cookson camp had attempted to bribe the Greek vote with €25,000 (£21,000), had asked them to canvas the Balkan countries, and had hoped that Igor Makarov would sponsor the Tour of Hellas. "That's absolutely preposterous," Cookson said later. "That's not the way I operate. Never have, never will."

Advantage McQuaid, but this was reversed a little later with an early setback in a vote to amend the constitution to enable presidential candidates either to be nominated by any two federations, or to guarantee nomination on the basis of incumbency.

That looked like a blatant attempt to overturn the refusal of the Swiss and Irish federations – McQuaid is resident in one, a native of the other – to nominate him. The toing and froing over the format of the vote was immense, and at one point the UCI's legal head Philippe Verbiest had to consult the constitution, but eventually it was over-ruled by the narrowest of margins, with a dead heat among the 42 delegates meaning there was no majority in favour.

That should have ruled out McQuaid's nomination by the Thai and Moroccan federations, but the lawyers were brought on, to debate the precise meaning of the clause in the UCI constution that states a presidential candidate must be nominated by "the federation of the candidate". The lawyers' gist was that ultimately a candidate did not have to live in a nation or hold a racing licence there in order to be a member of its federation.

Another legal eagle was brought on to suggest that McQuaid's nomination by the Swiss federation should stand, as it had been reversed after the nomination deadline. Amid the oceans of Franco-Swiss legalese it was impossible to avoid the impression that McQuaid's nomination would be secured, come hell or high water, and that the UCI constitution resembled Captain Jack Sparrow's pirate's code: "more what you would call guidelines than actual rules".

In the end, it was Cookson who accepted that McQuaid would be nominated. McQuaid's mantra all along had been that Congress should decide, that democracy would prevail, and whatever the legal arguments, the figures were beyond dispute.