Rebel Tory MPs helped defeat their own government today in a bid to stop the next Prime Minister suspending parliament to force through a no-deal Brexit.

Margot James resigned as digital minister after voting with Labour and ensuring the government lost by 41 votes – with 315 MPs backing the plan to stop parliament being prorogued, and 274 against.

A total of 17 Tories defied party orders and voted against the government, while four cabinet ministers – chancellor Philip Hammond, business secretary Greg Clark, justice secretary David Gauke and international development secretary Rory Stewart – abstained without giving a reason.

Such an act would normally lead to ministers being sacked from government, but with Theresa May having just six days left as Prime Minister she decided not issue dismissals.

A Downing Street spokesman said: “The Prime Minister is obviously disappointed that a number of Ministers failed to vote in this afternoon’s division.

“No doubt her successor will take this into account when forming their government.”

Foreign secretary Jeremy Hunt also failed to vote, but claimed it was because he mistakenly believed he had been been given permission by his party not to attend.

He tweet: “I missed votes today because I thought I was slipped and it turns out I was not.

“Apologies to my colleagues & Whips Office.

“My position is that parliament should NOT restrict the hands of an incoming govt in this way & I remain opposed to how parl voted.”

The size of the defeat lays bare the parliamentary challenge facing the next PM – likely to be Boris Johnson – if they try to take the UK out of the EU without a deal on 31 October.

The result of the vote means that if parliament is suspended, it has to be recalled for a minister to give an update to MPs about the status of talks to restart the power-sharing executive in Northern Ireland.

The Commons will then sit for five further days after this update – theoretically giving MPs more time to prevent a no-deal Brexit.

Johnson has repeatedly refused to rule out proroguing parliament to ensure the UK leaves the EU when the current negotiation extension ends on 31 October.

Labour MP David Lammy, a backer of the anti-Brexit group Best for Britain, said: “MPs from across the House, and with differing views on Brexit, have come together to stand up for the sovereignty of the British parliament.

“Parliament must never bow down to attempts to silence its voice. Any effort to shut it down to force through a no-deal Brexit is a direct attack on our parliamentary democracy. We will continue to resist as we have here.”

