The SNP has given its most explicit suggestion yet that it could back a time-limited government led by Jeremy Corbyn to prevent a no-deal Brexit.
Party leader Nicola Sturgeon said she “agreed” installing the Labour leader or “someone else” after a vote of no confidence in Boris Johnson was the only” failsafe” option.
She added that leaving the EU without a deal was a “terrible” idea.
Mr Johnson has said Brexit will happen on 31 October.
The prime minister is promising this, with or without a fresh withdrawal agreement with Brussels.
However, MPs have approved a law aimed at forcing the prime minister to request an extension to Brexit negotiations beyond 31 October, unless MPs approve a no-deal exit.
Downing Street has consistently said the government will obey the law, but Mr Johnson has also insisted he will not seek a delay to Brexit, which the act mandates.
Ms Sturgeon tweeted that she “agreed” with a suggestion made by journalist Sonia Sodha that the “only failsafe way is ensuring we get an extension [to Article 50, which would delay Brexit] if there’s no deal is for opposition parties to pass a vote of no confidence and install Corbyn or someone else as PM”.
Ms Sturgeon added: “Nothing is risk free but leaving Johnson in post to force through no-deal – or even a bad deal – seems like a terrible idea to me.”
Earlier this week, the Supreme Court ruled the government’s prorogation – or suspension – of Parliament for five weeks was “unlawful”.
Critics accused the prime minister of trying to stop MPs scrutinising his Brexit plans arguing the suspension was far longer than necessary.
The prime minister insisted he wanted to prorogue Parliament to outline the government’s policies in a Queen’s Speech.
‘The keys to No 10’
The SNP’s Westminster leader, Ian Blackford, told the BBC: “We need to remove Boris Johnson from office. We need to take the keys of Number 10 away from him.
“The key issue here is extending Article 50 and having an election. Whether it’s Jeremy Corbyn or someone else – we need a candidate who can deliver on that mandate of extending Article 50 and calling an immediate election.”
Asked specifically if that meant the SNP could support Corbyn-led government he said: “We will put in Number 10 whoever can deliver an extension to Article 50 and an immediate election.
“This isn’t about a government of national unity… it’s a mechanism to extend Article 50 and deliver an election.”
What is a vote of no confidence?
A motion of no confidence in Parliament allows MPs to hold a vote on whether they want the government to continue – and it has the power to trigger a general election.
If the government loses the vote, MPs have 14 days to express their support for an alternative government.
If an alternative government cannot command a majority in the House of Commons in that time, a general election could be held.
MPs opposed to a no-deal Brexit have previously considered passing a vote of no confidence in the government, but there has not been a clear consensus on who would replace Boris Johnson as prime minister.
Mr Corbyn has said he would be “ready to serve” as prime minister but Lib Dems and former Conservative MPs have so far been reluctant to support him.
In August, Lib Dem leader Jo Swinson suggested senior Tory MP Ken Clarke or former deputy Labour leader Harriet Harman could act as caretaker prime minister.