Sir Menzies Campbell was yesterday elected the new leader of the Liberal Democrats.
He secured 29,697 of the votes from party members, defeating his nearest rival Chris Huhne, who won 21,628.
Simon Hughes, the Lib Dem president, came third, having been knocked out under the party's transferable vote ballot system in a first round of voting.
Sir Menzies, the party's deputy leader, has been standing in for Charles Kennedy since he quit earlier this year after admitting a drink problem.
In the first round of voting, Sir Menzies polled 23,264, Mr Huhne 16,691 and Mr Hughes 12,081.
After Mr Hughes's second preference votes were re-distributed, the final tally of the 52,036 votes was Sir Menzies 29,697 and Mr Huhne 21,628, on a 72 per cent turnout of the membership.
The two beaten candidates said Sir Menzies would have their full support, and stressed the unity of the party.
Sir Menzies told supporters at the count, in Westminster's Smith Square: "Today is a victory not for me but for all Liberal Democrats. We have confounded our critics who wrote us off."
Mr Huhne said the new leader had a "hard-won and decisive mandate to lead this party to new advances with the backing of all of us".
He said the "thoughtful and good-tempered contest" had shown the party was the most united in Britain around the key issues.
Mr Hughes said: "I am absolutely clear that this party has a great future; I am absolutely clear that liberal democracy has a great future; and I am absolutely clear that we will go, Ming, under your leadership from strength to strength towards the government that Britain desperately needs and that we are all so unitedly determined to achieve."
Former leader Charles Kennedy welcomed the result.
"We have got a strong leadership under Ming and he will have my full and enthusiastic and loyal support," he said.
Sir Menzies said: "The challenge, as already been said, is to lead this party back towards government at the next general election."
The Dunfermline by-election victory had not only shocked Labour but "burst the bubble of Mr Cameron's Conservatives".
And the new leader said: "I am going to modernise our party so as to make a reality of three party politics in Britain." n Sir Menzies Campbell's leadership triumph has worsened the prospects for the Liberal Democrats at the next election, according to bookmaker William Hill.
They are now 80/1 - up from 66/1 - to win the next General Election.