The Prime Minister and her government "should be out of office tonight" after her Brexit deal suffered a second resounding Commons defeat, the First Minister has said.

Nicola Sturgeon described Tuesday's result, which saw May's revised EU withdrawal plans rejected by 149 votes, as "inevitable".

It is the fourth largest defeat for a sitting government in Commons history, with 242 MPs voting for it to 391 against.

Scottish secretary David Mundell, however, has turned his fire on those who knocked the deal down, telling MPs it is "incumbent on them to say what they do want".

The Prime Minister's revised deal included a new legally-binding document agreed with Brussels which committed both sides to working to find a way to avoid the controversial Irish backstop.

But after Attorney General Geoffrey Cox stated in legal advice that the changes secured did not fully remove the risk of the UK getting trapped in the backstop, Tory and DUP Brexiteers turned against it.

The defeat means MPs will now vote on whether they want to rule out a no-deal Brexit on Wednesday, with May confirming in a Commons statement that this would be a free vote on the Tory benches.

Mundell, the only Scottish MP in the UK Cabinet, confirmed to STV he would be voting to oppose no-deal, calling it "a bad outcome for Scotland".

If that vote is successful, the House will be offered the opportunity to back a delay to Brexit by extending Article 50 on Thursday.

Sturgeon accused May of continuing to "pander to Brexit extremists" in the wake of the first defeat of her EU withdrawal deal back in January.

The Prime Minister had been seeking to persuade Brussels to reopen the Withdrawal Agreement and provide assurances the backstop - a provisional UK-wide customs arrangement with the EU to prevent a hard Irish border - would only be temporary if used.

Speaking to STV's Scotland Tonight programme, the First Minister said: "By rights this Prime Minister and UK Government should be out of office tonight.

"This has been a dereliction of duty. After the first defeat the Prime Minister refused to listen.

"She continued to pander to Brexit extremists and made tonight's result inevitable and anybody could have seen that coming.

"The UK as a result stands on the brink of a Brexit cliff-edge and Theresa May's government has essentially ceased to function."

Reiterating her call for a second EU referendum, she continued: "What needs to happen now is that the House of Commons must decisively take no deal off the table, and it beggars belief that the Prime Minister is allowing a free vote on that.

"But then, having taken it off the table, there must be an extension to Article 50 long enough to allow a second EU referendum.

"Because if Parliament can't decide - and Parliament clearly can't decide - then the people must decide."

Sturgeon added that she would reveal her intentions regarding a potential second independence referendum "in short order" once the direction of Brexit is clear.

Also speaking to Scotland Tonight, the Scottish secretary pointed out the Prime Minister's deal had not been rejected as heavily as in the first "meaningful vote" in January.

Mundell said: "Clearly, Parliament has expressed a view twice to reject the deal, this time by a slightly smaller margin but still by a significant margin.

"We're now at the stage of trying to find a deal that can command majority support in Parliament, the ability to leave the EU and respect the referendum, but to do so on an orderly basis, and find if there is a majority for any particular way of doing that in Parliament.

"MPs have on numerous occasions now said what they don't want.

"I think over the next few days it's incumbent on them to say what they do want in order to be able to deliver that."

Pressed on what kind of deal he might support, the Scottish secretary said: "Obviously I've twice backed the Prime Minister's deal.

"I would be open to looking at variants on that deal if they could command a majority in Parliament...

"We have to understand what other people would bring forward, the people who say that they haven't wanted this deal."

On Wednesday's vote, he added: "I'll be voting against no-deal, I don't support a no-deal Brexit, I've been very clear throughout that is a bad outcome for Scotland, bad for the United Kingdom."