Nick Clegg was today elected the new leader of the Liberal Democrats.

He beat Chris Huhne by a very narrow margin, polling 20,988 to his rival's 20,477, after a two-month contest sparked by the resignation of Sir Menzies Campbell.

The announcement was made by acting party leader Vince Cable at London's St Martin's Lane Hotel.

The narrow margin of victory surprised Westminster, where most observers had regarded Mr Clegg as the front-runner.

Mr Huhne said: "I look forward to participating as part of Nick's team to make sure the party goes from strength to strength."

Mr Cable praised both candidates for the way they fought their campaigns and said either would have made an able leader.

Mr Huhne added: "This party is going to see even greater successes in the future than it has in the past. We have just elected a leader who is going to take us on from strength to strength."

A postal ballot of the party's 65,000 members closed on Saturday following a series of head-to-head hustings featuring Mr Clegg and Mr Huhne across the country.

Although Sheffield Hallam MP Mr Clegg was widely seen as being further to the right than his rival, the relatively low-key campaign revealed little in the way of policy differences between the two contenders.

Mr Clegg, 40, capitalised on his reputation as an effective and telegenic communicator who could boost the party's public profile, while 53-year-old Mr Huhne highlighted his experience outside politics in finance and journalism.

The biggest policy spat came when Eastleigh MP Mr Huhne said he would scrap Britain's Trident nuclear deterrent, while Mr Clegg said he would keep it at least until disarmament talks in 2010.

The contenders fell out over a briefing note produced by Mr Huhne's campaign team - apparently without his knowledge - branding his rival "Calamity Clegg".

Mr Cable - who ruled himself out of the contest on grounds of age - won plaudits for his caretaker role, which coincided with an opinion poll revival for the party.

His eight weeks in the spotlight made the 64-year-old economist an unlikely national hero for his dry wit and his ballroom dancing skills, which saw him take to the floor with Strictly Come Dancing star Alesha Dixon.

His Question Time claim that Prime Minister Gordon Brown had been transformed "from Stalin to Mr Bean" will go down as one of the political quips of the year.

Sir Menzies, 66, who beat Mr Huhne to the top job in March last year when Charles Kennedy was ousted after admitting a drink problem, faced constant jibes about his age during his 19-month stint in the party's top job.

Mr Brown's decision not to call a snap general election in the autumn speeded his departure by making it clear that a new leader would have 18 months or more to establish himself before going to the polls.

West Midlands MEP Liz Lynne said: "It was a very close contest which demonstrates that we had two very good candidates. I know Nick will make an excellent leader and will take us to even greater success in the future.

"He has pledged to reach out to people outside the party and I know he will be able to do that and we will go from strength to strength."