Five days of horse-trading among country's three political parties results in coalition rule between Conservatives and Lib Dems.
Cameron puts end to 13 years of Labour rule in UK
Speaking outside 10 Downing Street, Mr Cameron said that he would lead a government that was in "proper and full coalition" with the Liberal Democrats. He paid a generous tribute to Mr Brown's premiership saying: "We have some deep and pressing problems - a huge deficit, deep social problems, a political system in need of reform. "For those reasons, I aim to form a proper and full coalition between the Conservatives and the Liberal Democrats.
"I believe that is the right way to provide this country with the strong, the stable, the good and decent government that I think we need so badly." Mr Brown, who succeeded Tony Blair less than three years ago, emerged from 10 Downing Street with his wife Sarah at his side little more than an hour before Mr Cameron arrived. Standing on the steps of No 10, his voice cracking with emotion, he announced that he had informed the Queen's private secretary of his intention to resign and that he would be advising the monarch to appoint Mr Cameron as his replacement. "I wish the next prime minister well as he makes the important choices for the future," said Mr Brown.
"Only those who have held the office of prime minister can understand the full weight of its responsibilities and its great capacity for good. I have been privileged to learn much about the very best in human nature and a fair amount too about its frailties - including my own. "I have loved the job, not for its prestige, its titles and its ceremony, which I do not love at all. No, I loved the job for its potential to make this country I love fairer, more tolerant, more green, more democratic, more prosperous, more just - truly a greater Britain."
Mr Brown then left Downing Street for Buckingham Palace, holding hands with his wife and their sons John and Fraser. Within 30 minutes of Mr Brown tendering his resignation to the Queen, Mr Cameron was en route to the Palace to take over the reins of office at the end of 13 years of Labour rule. Having accepted the Queen's "invitation" to become PM, Mr Cameron headed to Downing Street with his wife Samantha to take up residence - though not in No 10 but, until the Browns move their things out, in the flat above No 11, the Chancellor of the Exchequer's residence.
Mr Brown's decision to go followed five frantic days since the general election in Britain in which the Conservatives had won 306 seats, Labour 258 and the Liberal Democrats 57 - all of them short of the 326 needed for an overall majority in the House of Commons. The battle was then on between the still-ruling Labour Party and the Conservatives to woo Nick Clegg, the Lib Dem leader, to enter into a coalition.
Mr Clegg said at the outset that the Conservatives, who received two million more votes than Labour, had a "moral right" to try and form the next government and he entered negotiations with them. But, on Monday evening, Mr Brown made the dramatic announcement that, in a bid to win over the Lib Dems with whom he has had an acrimonious relationship, he would stand down by the autumn. The result was that, yesterday morning, Labour and Lib Dem negotiators got down to trying to iron out an agreement to govern together.
By lunchtime, however, it was clear that there were insurmountable difficulties. Many senior Labour Party figures, including cabinet ministers, warned that such a liaison would enrage many party workers and voters, while Lib Dem MPs doubted that Labour could deliver on such issues as electoral reform. In the afternoon, Mr Clegg's representatives re-entered negotiations with the Tories who had become, as one Lib Dem official put it, "the only show in town".
At 43, Mr Cameron has now become Britain's youngest prime minister since Lord Liverpool took the job in 1812. He will also head the first coalition government in the UK since Winston Churchill's administration during the Second World War. Mr Cameron is expected to announce his senior ministerial appointments today with speculation rife that Mr Clegg will become deputy prime minister with Vince Cable, the highly regard Lib Dem economics spokesman, destined for an important role at the Treasury.
Both the Conservatives and Lib Dems have had to make major concessions to reach a deal. The parties do not seem natural bedfellows, the Tories to the right of centre and their new coalition partners to the left. It is understood that Mr Clegg has given way on the Tory demand for £6 billion (Dh32.5bn) of public sector cuts in the current year while the Conservatives have gone along with the Lib Dem plan to increase the tax-free limit for the wages of the lowest paid.
Although the Conservatives have promised voting reform, they have not gone nearly as far as backing the system of proportional representation that the Lib Dems so desperately desire. But the unifying force that brought the two parties together was the need to tackle Britain's budget deficit, which is running at record levels, and the task of ensuring that the country, which is showing signs of recovery after the global downturn, does not go into a "double dip" recession.
For the Labour Party, the task will be to find a new leader. Mr Brown not only resigned as PM but quit as party leader with immediate effect. Harriet Harman, the deputy leader, has taken over pro tem but a bitterly fought leadership campaign looks bound to follow. Among the leading contenders are two brothers: David Miliband, the foreign secretary, and Ed Miliband, the energy secretary. firstname.lastname@example.org