David Cameron's new Conservative government has a small majority - how will he manage to get his planned legislation through the House of Commons?

The prime minister faces a very different - and potentially more difficult - challenge now that he has a Commons majority of his own.

When he was the leader of a coalition government, he could command a majority of 76. He now has a majority of 12.

Every vote could potentially turn into a cliff hanger, with the prime minister's authority on the line.

The Liberal Democrats proved to be remarkably reliable coalition partners, voting through the vast majority of coalition policy, even when it was not in their own manifesto.

There were rebellions, over tuition fees (although the legislation got through with the votes of the Lib Dem frontbench), press regulation and Europe.

Image copyright PA Image caption Mark Harper will be tasked with imposing discipline on backbenchers

But much of the Conservative legislation that the Lib Dem leadership objected to was never put to the vote because Nick Clegg would not support it.

Some of this - such as the abolition of the Human Rights Act and the greater powers to monitor internet communications, the so-called "snooper's charter" - will be among the new government's first priorities and will be highly unlikely to meet much resistance from the Conservative benches.

But a sizeable group of Conservative backbenchers got used to rebelling against the government during the last Parliament and some may find it a hard habit to break. Which is why Mark Harper's role as the government chief whip - in charge of party discipline - will be a crucial one in Mr Cameron's new cabinet.

And if the next Labour leader is someone who can marshal his or her troops effectively and form alliances with other parties to keep pressure on the government, they have the power to make Mr Cameron's life a misery.

The prime minister is likely to get a honeymoon period from his own party.

One of the first people through the door at Number 10 when Mr Cameron claimed victory on Friday was Graham Brady, chairman of the 1922 committee, the mouthpiece of Conservative backbenchers.

Mr Brady said the prime minister had made a "very open offer" to the committee to involve them in policy making - almost an echo of the "open and comprehensive" offer Mr Cameron made to the Lib Dems in 2010.

Mr Brady said he hoped the leadership and backbenchers would work "harmoniously" and he was sure his colleagues would rise to Mr Cameron's offer "and try to respond in a constructive way".

"I hope that there will be a much wider conversation and starting much earlier in the policy development process, so that we ought to be able to anticipate problems and difficulties and work together to make sure that we can be as harmonious as possible in the obviously quite difficult confines of a very small parliamentary majority."

As a young Tory adviser in the early 1990s, Mr Cameron will have witnessed at first hand the difficulties of governing with a slender Commons majority and what can happen when your own backbenchers turn against you.

John Major began his time at prime minister with a majority of 21 seats - almost double Mr Cameron's - but by the end of his time in power he was facing a nightly battle to get legislation through after losing his majority altogether.

An organised rebellion over Europe - and the Maastricht Treaty - had turned Mr Major into a prime minister widely seen as lacking authority.

Mr Cameron may find he has to rely on the support of smaller parties to avoid a similar fate.

He may come to an arrangement the Democratic Unionist Party, which has eight MPs, although no decision has been reached about this.

The party would be likely to demand a price, in the form of economic help for their constituencies in Northern Ireland, in return for a formal agreement to support the government in key Commons votes.

Mr Cameron may even find himself relying on UKIP which - despite gaining 13% of the vote on Thursday - only has one MP, the former Tory maverick Douglas Carswell, in a knife-edge Commons vote.

The Lib Dems, with eight MPs, might also be called upon to support the Conservatives, although their new leader may wish to distance himself from the coalition era that did so much damage to the party.