Labour's Sadiq Khan has pledged to be a "mayor for all Londoners" as he was elected, breaking the Conservatives' eight-year hold on City Hall and becoming the first Muslim leader of a major Western city.

Mr Khan took 1,310,143 votes after second preferences were taken into account, beating Conservative Zac Goldsmith into second place on 994,614. His tally gave him the largest personal mandate of any politician in UK history.

The MP for Tooting referenced the campaign against him in his victory speech but said that London had chosen "unity over division" and "hope over fear".

Labour leader Jeremy Corbyn led congratulations on Twitter using the hashtag YesWeKhan, telling the new mayor: "Can't wait to work with you to create a London that is fair for all".

In a Facebook post, defeated Zac Goldsmith also congratulated Mr Khan and thanked "the hundreds of thousands of people who trusted me with their votes".

Fear doesn't make us safer, it only makes us weaker, and the politics of fear is simply not welcome in our city

But there were recriminations from Mr Goldsmith's side over his decision to target Mr Khan as a "radical" and highlight his supposed links with Islamist extremists.

Conservative former Cabinet minister Baroness Warsi said the "appalling dog whistle campaign" had "lost us the election, our reputation and credibility on issues of race and religion", and Mr Goldsmith's sister Jemima said the way the contest was fought "did not reflect who I know him to be".

David Cameron's former adviser Steve Hilton said the Richmond Park MP had brought back the "nasty party label" which Tories have fought to shake off.

Mr Khan delivered a barbed judgment on the Goldsmith campaign in his acceptance speech at City Hall, when he promised to be "a mayor for all Londoners".

Without naming his Tory rival, he said Labour had fought a "positive" campaign, adding: "Fear doesn't make us safer, it only makes us weaker, and the politics of fear is simply not welcome in our city."

Outgoing mayor Boris Johnson said: "Many congratulations to Sadiq on securing a huge mandate to do the best job in British politics. I wish him every possible success and will be calling him in the morning."

Mr Khan's 57% support after second preferences were counted amounted to a landslide victory on the largest turnout in the history of directly-elected mayors in London.

Labour fell one seat short of an overall majority on the London Assembly which scrutinises the mayor, taking 12 seats to the Tories' eight. Greens took two seats, Liberal Democrats one and Ukip won two seats - the party's first since 2004.

Human rights lawyer Mr Khan was the clear front-runner from the start of the counting process, which saw details of first preference votes released as they were collated using an electronic system. But "discrepancies" in the count delayed the final result until after midnight, forcing supporters to put celebrations on ice.

After the result was finally announced shortly before 12.30am, Mr Khan said: "I grew up on a council estate just a few miles from here. Back then, I never dreamt that someone like me could be elected as Mayor of London, and I want to say thank you to every single Londoner for making the impossible possible today.

"I have a burning ambition for London, an ambition that will guide me every day as mayor of our great city. I want every single Londoner to get the opportunities that our city gave to me and my family.

"The opportunities not just to survive, but to thrive, the opportunities to build a better future for you and your family with a decent and affordable home and a comfortable commute you can afford, more jobs with better pay, not just being safe but feeling safe, cleaner air and a healthier city. And the opportunities for all Londoners to fulfil their potential."

Mr Khan paid tribute to his late father, an immigrant from Pakistan and a London bus driver, who he described as "a wonderful man and a great dad".

"He would have been so proud today - proud that the city he chose to call his home has now chosen one of his children to be the mayor," he said.

To loud cheering from supporters in City Hall, Mr Khan said: "I promise to always be a mayor for all Londoners, to work hard to make life better for every Londoner, regardless of your background and to do everything in my power to ensure you get the opportunities that our incredible city gave to me."

Sign up to our free newsletters

Get the best updates straight to your inbox:
Please select at least one mailing list.

You can unsubscribe at any time by clicking the link in the footer of our emails. We use Mailchimp as our marketing platform. By subscribing, you acknowledge that your information will be transferred to Mailchimp for processing.