London, England (CNN) -- Gordon Brown resigned as British prime minister Tuesday paving the way for David Cameron to replace him.

Gordon Brown announced his intention outside 10 Downing Street -- the prime ministerial residence - before being driven to Buckingham Palace where he formally handed his resignation to the queen.

About one hour after Brown's resignation statement, Cameron -- leader of the right-wing Conservative Party -- became prime minister.

Brown said: "My resignation as leader of the Labour Party will take effect immediately."

Brown said he loved the job of prime minister not for pomp and ceremony, but "for its potential to make this country I love fairer, more tolerant, more green, more democratic, more prosperous and more just."

He called the job the "second most important I could ever hold," but said he looked forward to spending more time in the first -- husband and father.

He said earlier that he would recommend Cameron as his replacement.

The Conservatives won the largest number of seats, but not enough to let them govern on their own. Brown's left-wing Labour Party came in second, and the Liberal Democrats third.

Nick Clegg's Liberal Democrats first started coalition talks with the Conservatives, then began meetings with Labour.

It was not immediately clear if the Conservatives plan to form a minority government on their own or go into a coalition with the Liberal Democrats.

Neither Cameron nor Clegg made any immediate statement after Brown's resignation, which ended 13 years of Labour government in the United Kingdom, first under Tony Blair, and under Brown since 2007.

Cameron would be Queen Elizabeth II's 13th prime minister -- including Harold Wilson twice, for his two non-consecutive terms -- since she was crowned in 1952.

Brown announced Monday he would step down later in the year, a move seen as clearing the way for a potential Labour-Liberal Democrat alliance.

But talks between the two ended just after lunch Tuesday, with no word on the outcome or when the talks might resume.

Full election coverage

A senior Labour party politician told CNN Tuesday that the party was right to have talked to Clegg's party.

But Labour should now go into opposition, former Lord Chancellor Charles Falconer said. Labour has been in power for 13 years.

Shortly after the Labour-Lib Dem talks ended, Liberal Democrat negotiators entered a meeting with the Conservative Party.

"We believe very strongly that there should be a government with a strong and secure majority in the House of Commons, and of course with an elected prime minister," Conservative negotiator William Hague said as he entered the meeting. "We remain very firmly of that view. We set out our proposals to achieve that yesterday, and we have come here to hear the Liberal Democrats' response."

Labour negotiator and Cabinet member Ed Balls told Sky News before Tuesday's talks that the two parties had areas of agreement and disagreement, "but also, the country needs a stable government, and that's what we've got to see if we can achieve."

As he left his home Tuesday before the talks, Clegg said he was hoping to "clear up everything" soon.

Will a coalition be bad for Britain?

"I'm as impatient as anybody else to get on with this, to resolve matters one way or another," Clegg said.

Over the weekend and again on Monday, the Liberal Democrats held talks with the Conservatives, who received the most votes in last Thursday's election but not enough to form a majority.

One possibility is a coalition between the Liberal Democrats and the Conservatives, which would give the latter the majority they need in the House of Commons. The parties remain far apart on key policies, however.

Conservative leader Cameron said Tuesday morning he had made a "very open, very reasonable offer" to the Liberal Democrats during the discussions and that it was now "decision time" for Clegg's party.

"I hope they make the right decision," Cameron said outside his London home.

Brown announced Monday he was stepping down as head of the Labour Party, which effectively means he is leaving the post of prime minister, but it won't happen right away. He said he hoped a new leader would be in place by the next party conference, scheduled for September.

Top Labour party members declined to speculate Tuesday on Brown's replacement.