Sadiq Khan, the son of a bus driver, became London's first Muslim mayor on Saturday, seeing off a Conservative challenger who attempted to link him to extremism and securing a much-needed win for his opposition Labour Party.
Khan's victory, which also makes him the first Muslim to head a major Western capital, was confirmed shortly after midnight inside London's futuristic glass and steel city hall following a day of mixed news for Labour in elections elsewhere in the country.
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.
"This election was not without controversy and I am so proud that London has today chosen hope over fear and unity over division," Khan said in a short speech after the results.
"I hope that we will never be offered such a stark choice again. Fear does not make us safer, it only makes us weaker and the politics of fear is simply not welcome in our city."
Plaudits for Khan flooded in from as far afield as New York, whose mayor Bill de Blasio said on Twitter: "Sending congratulations to London's new mayor and fellow affordable housing advocate, @SadiqKhan."
Khan's 13.6 percent margin of victory over Goldsmith was the widest in a London mayoral election in 16 years, showing that a bitter campaign marred by accusations that Khan had links to extremists and charges of anti-Semitism within Labour ranks had failed to deter his voters.
The Labour lawmaker replaces Conservative Boris Johnson, who ran 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, looking exhausted after a much delayed result, made an emotional speech referencing his Pakistani father, who he said would have been "proud that the city he chose to call his home, has now chosen one of his children to be the mayor."
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 the 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.