LONDON - London's new mayor, an eccentric Conservative legislator, was sworn in Saturday after ousting the left-wing incumbent in a vote that capped the worst local election results for Prime Minister Gordon Brown's party in four decades.

Idiosyncratic ex-magazine editor Boris Johnson said his triumph over Labour's incumbent Ken Livingstone offered a glimpse of Britain's likely political future.

The result -- Johnson polled 1,168,738 to Livingstone's 1,028,966 -- capped a disastrous performance for Brown's governing Labour in the party's first electoral test since he assumed power when Tony Blair quit last June.

Johnson won 53.2 per cent of the vote, compared to Livingstone's 46.8 per cent.

"The Hair of London'' read the headline in Saturday's edition of the Sun newspaper above a photo of Johnson from the forehead up comparing his trademark tousled coiffure to a golden crown.

Johnson's self-deprecating sense of humour showed as he joked about nearly tripping on his way to the podium after signing the declaration of office Saturday. He officially takes over as mayor at midnight Sunday.

"Until that time, I imagine there are shredding machines quietly puffing and panting away in various parts of the building,'' Johnson said.

In a brief speech, he reiterated promises to tackle crime, improve the bus system and increase affordable housing.

Afterward, he met with the police and transport commissioners, and experts he hopes to enlist as part of his team.

Johnson, as famous for his witty TV slots as for his rumpled appearance, frequent gaffes and occasional offensive outbursts, pledged a new, serious attitude as mayor.

Brown, dogged by accusations of dithering and incompetence, was forced to make a humble pledge to heed the scathing verdict from voters after his party lost both London's City Hall and more than 300 municipal council seats.

His main political foe, opposition Conservative party chief David Cameron, said his party's gains in the capital and in a longtime weak spot in northern England represented a key moment on the path to ousting Brown in the next national election.

Results from the 159 local councils that held ballots in England and Wales on Thursday showed the Conservatives gaining 260 seats, and Labour losing 333.

But no Conservative victory was more symbolic than the one in London. Johnson becomes the first Conservative to hold a high-profile national post, controlling a budget of billions and charged with planning for the 2012 Olympics, since his party's thumping 1997 national election defeat by the Labour party, then led by Blair.

Cameron hopes to be next; he will square off against Brown in a national poll before mid-2010.

"Three years ago, the idea that the Conservatives would win London and build up a 20-point lead across the county would have been literally unthinkable,'' he said Saturday.

Johnson paid tribute to Livingstone's role in guiding London through the 2005 transit network bombings. But he said his victory may suggest Britain's future political direction.

"I do hope that it does shows that the Conservatives have changed into a party that can again be trusted,'' Johnson said.

An emotional Livingstone, the city's first-ever elected mayor, and in power since 2000, said the blame for his defeat must rest at his door, not Brown's. Livingstone, a staunch leftist who courted Venezuela's Hugo Chavez, frequently embarrassed his party's national leadership.

Johnson's own erratic outbursts mean he may have a similar relationship with Cameron. He once caused huge offence by labelling people in some Commonwealth countries "piccaninnies'' -- a derogatory term for black children -- and also referring to Africans as having "watermelon smiles.''

As editor of the weekly political magazine The Spectator, Johnson survived the embarrassment of an affair with one of his writers. He called the adultery reports "an inverted pyramid of piffle'' but was removed from the Conservative front bench when party leaders decided that was a lie.

He has mounted attacks on gay marriage, campaigns promoting healthy eating in schools and the northern city of Liverpool. In 2003, Johnson claimed to have looted a cigar case from the ransacked home of ex-Saddam Hussein aide Tariq Aziz during a visit to Iraq.

Even after his victory, Johson said it is likely "there will be the odd ill-chosen expression'' in future.