Sadiq Khan, the son of a bus driver, became London's first Muslim mayor on Friday, seeing off a Conservative challenger who attempted to link him to extremism and securing a much-needed victory for his opposition Labour Party.
As New York mayor Bill de Blasio sent his congratulations, Khan had yet to receive official notification of his victory, which would go some way to soothing the wounds of Labour which suffered losses in Thursday's other local elections.
Dealt a crushing blow in Scotland, where it came third behind the Scottish National Party and Britain's ruling Conservatives, Labour did better than expected in England, saving its left-leaning leader from an early challenge.
But the big prize was the London mayor vote, which pitted Khan, 45, who grew up in public housing in inner city London, against Conservative Zac Goldsmith, 41, the son of a billionaire financier.
A source close to the count said Khan could not now be beaten in the race. De Blasio said on Twitter: "Sending congratulations to London's new mayor and fellow affordable housing advocate, @SadiqKhan."
Khan's margin of victory looked set to be narrower than expected in a possible sign that a bitter campaign marred by charges of anti-Semitism and extremism and charges of anti-Semitism in Labour ranks might have taken its toll.
The Labour lawmaker replaces Conservative Boris Johnson, who has run the city of 8.6 million people for eight years. A top campaigner for Britain to leave the EU, Johnson is seen as a contender to succeed David Cameron as party leader and prime minister.
The Conservatives were keen to keep hold of the post, which does not run the City of London financial district but has influence over government in lobbying for the capital. The mayor is responsible for areas such as policing, transport, housing and the environment.
Khan held his lead in the opinion polls, despite accusations by Goldsmith that he has shared platforms with radical Muslim speakers and given "oxygen" to extremists.
Khan says he has fought extremism all his life and that he regrets sharing a stage with speakers who held "abhorrent" views. The Labour Party accused Goldsmith and the ruling Conservative Party of smearing Khan.
Goldsmith denied the charge, saying he had raised legitimate questions over his opponent's judgment - but the tactics do seem to have backfired with some voters interviewed by Reuters saying they found the campaign "disgusting and slimy".
While fighting those charges, Khan, a former human rights lawyer, also distanced himself from the newly elected Labour leader, Jeremy Corbyn, after a row over anti-Semitism.
The Labour leader ordered an inquiry into charges of anti-Semitism after suspending Ken Livingstone, a political ally and a former London mayor, for saying Adolf Hitler had supported Zionism.
The impact of the crisis was difficult to gauge in the election of more than 2,700 local officials and new devolved authorities in Scotland and Wales.
Compared to the last regional elections in 2011, Labour's share of the vote was down 9.2 percent in Scotland and 7.6 percent in Wales, allowing a strong showing for the anti-EU UK Independence Party before a referendum on membership of the bloc on June 23.
But, with fewer losses in England than expected, Corbyn was able to rally enough support to prevent an early challenge.
Corbyn, who was elected as party leader last year on a wave of enthusiasm for change and an end to 'establishment politics' among mostly younger members, welcomed some of the results and said he would fight to re-establish Labour in Scotland.
"We hung on and we grew support in a lot of places," he said.
But he did little to quell criticism of his leadership in a party which has moved from crisis to crisis, the latest a row over anti-Semitism forcing Corbyn to suspend Livingstone.
Richard Angell, director of Labour activist group Progress, said the party had to refocus on issues that concern voters.
"Corbyn need to shake up his operation, kick out Ken Livingstone as a first step to nailing the anti-Semitism problem and focus on voter-friendly policy," he told Reuters.