By Alex Stevenson Follow @alex__stevenson
and Ian Dunt Follow @IanDunt
Boris Johnson has seen off Labour hopes of a Ken Livingstone revival to triumph in the 2012 London mayoral race.
He secured four more years in City Hall by taking 1,054,811 votes to Ken's 992,273, beating the veteran Labour candidate once again.
In the wake of the decision, the Labour candidate announced he would not contest any further elections.
Ken said he was "sorry" he had not won the mayoralty before announcing: "This is my last election."
He had fought 11 elections and lost three, he said, before adding: "The one that I most regret losing is this. This is the defeat I most regret because these are the worst times for 80 years... I am sincerely sorry for those Londoners who desperately wanted us to win but I failed to do that.
"I will continue to bear and they will continue to bear the pain of this recession without the help of City Hall."
In a comment which was designed to highten tensions between Boris and David Cameron, he added: "I suspect this result has settled the question of the next Tory leadership election."
Tory supporters had been confident of victory for much of Friday, although hopes of a last-minute rally among second-preference voters for Ken had kept interest in the contest alive.
But the final result - which came after lost ballot boxes caused an agonising delay of several hours - confirmed expectations throughout a bitterly contested campaign that Boris would eventually prevail.
"I will continue to fight for a good deal for Londoners," Boris pledged, before offering some "complimentary things" to defeated rival Ken.
"Above all I want to thank the people of London - those who voted for me yesterday, those who didn't, those who thought about it and then did, those who thought about it and then didn't - I want to thank all of you for giving me a new chance and a new mandate to take us forward."
Ken Livingstone won on second preference votes, taking 102,355 to Boris' 82,880. But the Conservative took 971,931 first preference votes compared to Ken's 889,918, giving Boris an advantage which saw him to victory.
Green party candidate Jenny Jones came third with 98,913 votes. Liberal Democrat Brian Paddick was fourth on 91,774, with independent Siobhan Benita finishing in fifth on 83,914.
The result mars otherwise positive results for Labour nationally, which have seen Ed Miliband's party continue to re-establish itself as a major player in local government in England, Scotland and Wales.
Labour now holds 2,158 council seats – a gain of 823. The Conservatives hold 999 seats, having lost 406.
The Liberal Democrats had another disastrous night, losing 335 seats and keeping just 425.
The Scottish National party won 57, leaving them with 424. Plaid Cymru lost 41 seats and are left with 158.
The results prompted right-wing Tory backbenchers to demand a rightward shift in coalition policy and for the prime minister to stop making allowances to the Liberal Democrats.
Labour won an outright majority in Glasgow, where many analysts predicted they would lose to the SNP.
Projected vote shares based on the results of the local elections suggest that if a general election was held today, Labour would win 38% of the vote - up two points on last year's results.
The Tories would win 31%, down four, and the Liberal Democrats would win 16%, unchanged.
Ed Miliband, whose day was tainted slightly when he was pelted with an egg in Southampton, cut a modest figure as he toured the country.
"There are lots of people who didn't vote and lots who didn't vote Labour," he told supporters.
"We know we have lots to do to regain your trust. Politics can make a difference. Not all politicians are the same. Labour will keep its promises. It is on your side."
David Cameron said the coalition would continue with its austerity programme, despite the result.
"These are difficult times and there aren't easy answers," he said.
"We'll go on making tough decisions. We've got to do the right thing for our country."
Nick Clegg said he was determined the Liberal Democrats would "continue to play our role".
He added: "It's been a disappointing and difficult night for the Liberal Democrats. I'm really sad so many colleagues and friends - Lib Dem councillors who worked so hard for so many years - have lost their seats."
Labour made significant wins in difficult seats such as Sefton, Wirral and North East Lincolnshire, as well as major cities such as Southampton.
It also proved it could pick up councils in key southern parliamentary marginals like Thurrock, Harlow and Great Yarmouth which deserted it in 2010.
"Labour seems to be fighting back," the University of East Anglia's Professor John Greenaway told politics.co.uk.
"To do well, to get back into government, they have to win seats in southern cities... I think it will be interesting to see what effect this has on the Tory party.
"There will be those on the Tory right who say let's go back to Thatcherite conservatism, whereas of course there'll be the others who are saying we've got to be a party of all the people."
There were some setbacks, however. Labour's leader on Bradford council lost his seat to a Respect candidate, in another blow to the party's credibility in the city. George Galloway, who recently became the constituency's MP, said Labour had to learn to "behave more like us".
Voters almost uniformly rejected coalition plans for elected mayors, with just one city – Bristol – voting to change its political arrangements.
Those results were a major humiliation for the prime minister, who only last month made a keynote speech promoting the idea.
"This will be a pretty major blow for the government's localism agenda," Stuart Wilks-Heeg of Democratic Audit said. "The campaign in favour has been absolutely lacklustre."
Of particular concern to the Conservatives will be the strong showing at the polls by Ukip, which averaged 14% in the 750-odd seats it contested.
"Cameron should be worried because it shows many of his traditional voters don't like what he's doing," Ukip leader Nigel Farage told politics.co.uk.
"He should be a more Conservative prime minister."