London has elected its first Muslim mayor, with Sadiq Khan delivering a resounding victory for Labour and ending eight years of Conservative rule at City Hall. As the results were finally announced well after midnight on Saturday morning, Mr Khan said: "This election has not been without controversy. I am so proud that London has chosen hope over fear and unity over division. I hope we will never be offered such a stark choice again."

Mr Khan lead his Conservative rival Zac Goldsmith by a total of 315,529 votes when the second preference votes were counted and reallocated. He received 1,310,143 votes, higher than for any previous London Mayor. This amounted to 57 per cent of the total final votes to Mr Goldsmith's 43 per cent (994,614 votes). Turnout was 45.6 per cent, up from 38 per cent in 2012.

A tired Sadiq Khan speaks at City Hall after being confirmed as the new London Mayor - with Paul Golding, to his left, turning his back (AP)

Mr Khan capped an assured campaign with a convincing triumph, while Goldsmith faced a growing backlash over a campaign which critics described as “divisive” and dependent on “dog whistle” politics.

Mr Khan said that he was "deeply humbled" by the trust that voters had put in him. He also paid tribute to his mother, and his late father, saying: "My dad would be so proud that the city he chose to call home has chosen one of his children to be Mayor."

Referring to the often contentious campaign, Mr Khan said: "Fear does not make us safer - it only makes us weaker. And the politics of fear is simply not welcome in our city."

Mr Goldsmith's campaign faced criticism for focusing on attempts to link Mr Khan to Islamist extremists, with whom he had in the past shared platforms or represented during his work as a lawyer. The campaign was also criticised for sending letters to voters targeted according to their ethnic group.

At the announcement, Mr Goldsmith paid tribute to Mr Khan, and said: "I wish him well as he sets out to build on the successes that we've seen under Boris Johnson and to take it even further."

As the outcome of the race became clear, senior Conservatives joined the backlash against the Goldsmith campaign.

Nastiest moments in the London mayoral election

Sayeeda Warsi, the former party chairman and the first Muslim woman to attend Cabinet said the “appalling dog whistle campaign” had “lost us the election, our reputation and credibility on issues of race and religion”.

Lady Warsi, the former Conservative party chairman, described it as "appalling".

Recriminations even extended even to Mr Goldsmith's own family, with sister Jemima, a journalist and campaigner, tweeting that she was “sad” her brother’s campaign “did not reflect who I know him to be – an eco-friendly, independent minded politician with integrity”.

Steven Norris, a former MP and mayoral candidate, insisted it was "no use having a dog whistle when everybody can hear it".

And Andrew Boff, Conservative group leader on the Greater London assembly, said: “It was ridiculous… I do believe it’s going to affect Conservatives at the sharp end, especially in those parts of London where there is a high Muslim population. I mentioned that I thought this was a mistake for future integration in London. If you are a London politician this is just a bizarre thing to do.”

Former minister and Labour MP for Tottenham David Lammy said voters had reacted against a campaign that he called “divisive” and “laden with smear”.

“Right across London, black, white and brown have gone out and voted for unity,” he told The Independent. “This is the first time an ethnic minority politician has been given a mandate from millions of people,” he added.

"It’s an extraordinary moment, one we can all delight in whatever our political party… Right across the world they will be talking about this election result. It’s a global moment.”

New York’s mayor Bill de Blasio tweeted his congratulations to Mr Khan, calling him a “fellow affordable housing advocate” and said he was looking forward to working with his new counterpart.

In pictures: Local elections 2016 Show all 10 1 /10 In pictures: Local elections 2016 In pictures: Local elections 2016 Mayor of London Boris Johnson and wife Marina leave after casting their votes at a polling station in Islington, north London PA In pictures: Local elections 2016 Northern Ireland First Minister, Arlene Foster (C), Rhonna McMahon (R) and Paul Robinson leave after casting their vote for the Assembly Election, at Brookeborough Primary School in Enniskillen, Northern Ireland Reuters In pictures: Local elections 2016 Labour party leader Jeremy Corbyn arrives to cast his vote at a polling station in Islington, north London PA In pictures: Local elections 2016 David Cameron and Samantha Cameron cast their votes in the London Mayoral Election in London Getty Images In pictures: Local elections 2016 Labour Party Mayoral candidate Sadiq Khan and his wife Saadiya pose outside The Richardson Hall St Alban's Church Centre in Streatham after casting their votes in London's Mayoral and Assembly elections Getty Images In pictures: Local elections 2016 Britain's Conservative party candidate for Mayor of London Zac Goldsmith and his wife Alice leave after voting at a polling station in the Barnes suburb of south west London AP In pictures: Local elections 2016 George Osborne casts his vote in the London Mayoral Election in London Getty Images In pictures: Local elections 2016 SNP supporter Trish Traynor outside a polling station at St Ninian & Triduana RC Church in Glasgow as the polls open in the Scottish Parliament election PA In pictures: Local elections 2016 Scottish Labour leader Kezia Dugdale (right) with partner Louise Riddell outside a polling station in Edinburgh after casting her vote in the Scottish Parliament election PA In pictures: Local elections 2016 SNP leader Nicola Sturgeon with her husband Peter Murrell after casting her vote at Broomhouse Community Hall polling station in Glasgow as Scotland goes to the polls in the Scottish Parliament election PA

The win represents a major boost for Labour, which had suffered the humiliation of slipping to third place in Scotland, once a stronghold for the party.

But Mr Khan, a former human rights lawyer, has distanced himself from Corbyn throughout his campaign, particularly over the party leadership's handling of allegations of antisemitism within Labour ranks.

In Wales, Labour lost control of the Welsh Assembly after the totemic seat of Rhondda fell to the Plaid Cymru leader Leanne Wood.

But in English council elections, the party faired less badly than many pundits had expected – losing only 25 seats of the 1,200 it was defending.

Zac Goldsmith

The party also retained control of key councils such as Crawley, Southampton, Norwich and Hastings, where its vote had looked vulnerable.

But critics of Mr Corbyn pointed out that such a result was still nowhere near good enough to win a General Election, while the Labour leader himself admitted that they had “hung on”.

Boris' message to next mayor

"I don't think that the public see the UK Labour Party led by Jeremy Corbyn at the moment as being a credible party of future government in 2020,” Ian Murray Labour’s shadow Scottish secretary admitted.

“That's something, after this week's results, we should reflect on.”

Among the other highlights from the day's results: