MPs voted to ban wild animals in circuses last night after David Cameron's attempts to bully Conservative backbenchers into voting against the measure backfired and ended in a humiliating public defeat. In a decision hailed by campaigners as an "historic victory for animal welfare and protection", MPs of all parties unanimously backed a ban and the Government signalled that it would introduce one, ending forever the days of lions, tigers, elephants and other wild animals in the big top.

In an act of desperation, Conservative whips had warned they would impose the most serious parliamentary voting sanction, a three-line whip, to bring recalcitrant backbenchers to heel and get them to support the Government's alternative proposal of a licensing system. But in a victory for The Independent's campaign for a ban and for the long campaigns waged by animal welfare organisations, Downing Street backed down when it became apparent that it would lose the vote despite what backbenchers described as "desperate" measures. One of the three MPs who brought the cross-party motion for a ban disclosed that he had first been offered a government job – and then threatened that the Prime Minister would look "very dimly" on his recalcitrance – unless he amended or withdrew the motion. Mark Pritchard, a Conservative backbencher, stood firm and insisted that the measure be voted upon.

As astonished MPs listened, Mr Pritchard said: "Well I have a message for the whips and for the Prime Minister of our country – and I didn't pick a fight with the Prime Minister – I may just be a little council house lad from a very poor background but that background gave me a backbone. It gives me a thick skin and I'm not going to be cowed by the whips of the Prime Minister on an issue I feel passionately about and have conviction about.

"There may be some other people with backbones on this side and they will speak later, but we need a generation of politicians with a bit of spine, not jelly. And I will not be bullied by any of the whips."

MPs from all sides of the House including the Liberal Democrat MP Don Foster, Labour's Nia Griffiths and the Green leader Caroline Lucas attacked the Government's position, saying that both public and parliamentary opinion was in support of a ban.

The motion was to "direct" the Government to introduce a ban.

Shortly before the vote, the Animal Welfare minister, Jim Paice, said: "If at the end of this debate the House were to approve this motion then of course we will have to respect that."

Animal welfare groups were ecstatic. The RSPCA said: "This is a win for democracy as well as animal welfare." It said it hoped the Government would quickly and formally announce a ban.

Animal Defenders International, the group which shot undercover footage of the beating by a Romanian groom of Anne the elephant at Bobby Roberts Circus, said: "This debate and vote has exposed the Government and demonstrated just how out of touch they have been with their peers, the public, and animal welfare groups."

Mary Creagh, the shadow Environment Secretary, said: "The public will be absolutely delighted that MPs from all parties have stood up to the Tory-led Government on this issue to achieve such a fantastic result. The vote brings to an end 48 hours of chaos and confusion from the Government about their position on a ban. It is extraordinary that David Cameron used such bully-boy tactics to threaten his own MPs and tried to impose a three-line whip on the vote."

The Government had initially planned to ban wild animals from circuses but the Department of the Environment, Food and Rural Affairs was forced to do a U-turn, and instead proposed a licensing system, after Mr Cameron, a keen hunter and shooter, blocked the move.

Mr Paice blamed a court challenge to a ban in Austria for the decision, but there was no court challenge and he was forced to admit during an emergency debate, called because of the misinformation, that he had misled the Commons. The Government's subsequent claim that a ban could be challenged under the Human Rights Act or the EU Services Directive was challenged by lawyers and the European Commission.

The Government and MPs came under intense pressure from voters. More than 32,000 signed The Independent's online petition calling for the Government to change its mind, and supporters of the protest group 38 Degrees, which had forced Defra to abandon plans for its forests sell-off, deluged MPs' offices with hundreds of emails, letters and phone calls.

During the debate, MPs said the issue was emblematic of wider animal welfare issues. But the most astonishing contribution came from Mr Pritchard who had secured the backbench debate, which should have had a free vote. He said: "On Monday if I offered to amend my motion or drop my motion or not call a vote on this motion – and we're not talking about a major defence issue or an economic issue or an issue of public-sector reform, we're talking about a ban on wild animals in circuses – I was offered reward and incentive. If I didn't call for a ban – I was offered a job. Not as a minister, it was a pretty trivial job.

"Then it was ratcheted up to last night and I was threatened. I had a call from the Prime Minister's Office directly and I was told unless I withdrew this motion that the Prime Minister himself would look upon it 'very dimly indeed'."