The British Labour party's Sadiq Khan has been sworn in as London's new mayor after comfortably beating his nearest rival, Conservative MP Zac Goldsmith.
Speaking at the ceremony at Southwark Cathedral on Saturday, Khan called the city the "greatest in the world", adding he was "proud" and "deeply humbled" by his win.
"I want every single Londoner to get the opportunities that the city gave to me and my family...the opportunities not just to survive, but to thrive," Khan pledged.
OPINION: Londoners win as Sadiq Khan cruises to victory
Khan picked up 44 percent of first preference votes to Goldsmith's 35 percent. The Labour candidate then picked up enough second preference votes to cross the 50 percent threshold, with 57 percent to Goldsmith's 43 overall.
The Labour party's leader Jeremy Corbyn congratulated Khan on his victory on Friday evening.
Conservative MP Zac Goldsmith's campaign has been marked by accusations of being "dirty" and "negative" , including from within his own party, for its emphasis on Khan's ties to alleged extremists.
Critics have accused Goldsmith of attacking Khan on the basis of his Muslim faith and labelled his campaign racist , a claim he denies.
Khan, who calls himself "the British Muslim who will take the fight to the extremists", accused Goldsmith of trying to scare and divide voters in a proudly multicultural city of 8.6 million people, more than 1 million of them Muslims.
Al Jazeera's Barnaby Phillips, reporting from London, said the victory was of "great symbolic importance" for the UK and internationally.
"What was interesting was that the campaign became much more personal, much more bitter, and much more ugly, than what many people had anticipated," Phillips said.
"The Conservative candidate Zac Goldsmith repeatedly attacked Sadiq Khan as someone who had fraternised and shared platforms with Muslim extremists.
"Sadiq Khan and Labour's response was very angry, they said that the Conservatives were playing a subtle and even not so subtle, Islamophobic and racist campaign."
The new mayor of the UK's capital is the son of immigrants from Pakistan who settled in London in the 1960s, where his father worked as a bus driver.
Khan studied law and later became a human rights lawyer before being elected as the Labour MP for the London constituency of Tooting in 2005.
Gordon Brown, the former British prime minister, included Khan in his cabinet, first as minister for communities and then transport. After Labour lost power in 2010, its leader Ed Miliband included Khan in his shadow cabinet.
Social media reaction
Some of the fault lines surrounding Khan's election were visible on social media as soon it became clear he was the most likely candidate to win.
Huge numbers congratulated Khan and expressed pride in the UK's diversity, but for others it was more evidence of the supposed Islamisation of the West. This despite Khan's progressive voting record that has put him at odds with religious conservatives.
Many users mocked what they saw as xenophobic responses to Khan's mayorship.
Labour's expected success in London was marred by a poor showing in the Scottish assembly where the pro-independence Scottish National Party secured control for a third term.
The nationalists fell two seats short of the 65 needed for a majority but can form a minority government as the largest party.
Labour fell to third place in their former heartland, losing 13 seats for a total of 24, with the Conservatives gaining 16 to secure 31 altogether.
The Greens, who were the only other major party to back independence in Scotland, gained four seats for 6 seats in total, while the Liberal Democrats maintained their five.
Source: Al Jazeera and agencies