LONDON – Conservative leader David Cameron became Britain’s new prime minister Tuesday, ending 13 years of Labour Party rule and opening the door to an unprecedented coalition government with the third-party Liberal Democrats.

After three days of negotiations between the parties, Cameron emerged from Buckingham Palace, where Queen Elizabeth II formally invited him to form a government. The Conservatives fell just short of a majority in last week’s election and sought the support of the Liberal Democrats to solidify their grip on power.

Cameron left the palace for the prime minister’s official Downing Street residence, which had been vacated earlier by Gordon Brown. Early in the day, Brown stepped down as prime minister and Labour leader, having failed in his own attempt to strike a deal with the Liberal Democrats.

Announcing his resignation, Brown said he was making way for a new leader.

“It was a privilege to serve, and yes, I love the job, not for its prestige, its titles and its ceremony, which I do not love at all,” Brown said, with his wife, Sarah, at his side. “No, I love the job for its potential to make this country I love fairer, more tolerant, more green, more democratic, more prosperous and more just, truly a greater Britain.”

Such a changeover in government would close the door on 13 years of “New Labour,” the centrist experiment and party makeover pioneered by Tony Blair. Brown, 59, served as Blair’s formidable No. 2 for a decade before finally inheriting the top job three years ago.

Cameron, 43, was expected to announce a power-sharing deal with the Liberal Democrats that will see the smaller, left-leaning party in government for the first time in decades. Cameron’s Cabinet is likely to include senior figures from the Liberal Democrats such as Nick Clegg, the party’s leader.

Clegg, who is the same age as Cameron, has been in the position of kingmaker since Thursday’s general election, which produced the first divided Parliament without a single-party majority in 36 years. The Liberal Democrats came in third, but held the balance of power.

Brown said he would step down immediately from his post as party leader, and may leave politics rather than remain a backbench member of Parliament.