Tory rebels and opposition MPs have defeated the government in the first stage of their attempt to pass a law designed to prevent a no-deal Brexit.

The Commons voted 328 to 301 to take control of the agenda, meaning they can bring forward a bill seeking to delay the UK’s exit date.

In response, Boris Johnson said he would bring forward a motion for an early general election.

Jeremy Corbyn said the bill should be passed before an election was held.

In total, 21 Tory MPs, including a number of ex-cabinet ministers, joined opposition parties to defeat the government.

After the vote, Downing Street said those Tory MPs who rebelled would have the whip removed, effectively expelling them from the parliamentary party.

No 10 had hoped the threat of expulsion – and an election – would bring would-be rebels into line.

The prime minister said the MPs’ bill would “hand control” of Brexit negotiations to the EU and bring “more dither, more delay, more confusion”.

He told MPs he had no choice but to press ahead with efforts to call an October election, adding: “The people of this country will have to choose.”

The result means the MPs will be able to take control of Commons business on Wednesday.

That will give them the chance to introduce a cross-party bill which would force the prime minister to ask for Brexit to be delayed until 31 January, unless MPs approve a new deal, or vote in favour of a no-deal exit, by October 19.

The BBC understands the government intends to hold an election on October 15, two days before a crucial EU summit in Brussels.

To call an election under the Fixed-term Parliaments Act, Mr Johnson would need support from Labour as he requires the backing of two-thirds of the UK’s 650 MPs.

But Mr Corbyn said the legislation backed by opposition MPs and Tory rebels should pass before any election was held, to “take no deal off the table.”

The BBC’s chief political correspondent, Vicki Young, said the government was framing the situation as the Labour leader trying to block Brexit, and that would be its argument going into a general election.

SNP Westminster leader Ian Blackford said he was “delighted” that MPs had expressed a “very clear view” in favour of a law to block no deal.

“Boris Johnson and his government must respect the right of parliamentarians to represent the interests of their constituents,” he said.

“Yes, there must be an election, but an election follows on from securing an extension to the [Brexit deadline].” (BBC)