Media playback is unsupported on your device Media caption Liam Fox warns MPs 'may try to steal Brexit'

There is a risk MPs could "steal Brexit from the British people" if Theresa May's proposed deal is rejected, a senior cabinet minister has warned.

Liam Fox said there was "natural Remain majority" in Parliament and any attempt to overturn the 2016 referendum vote would be a "democratic affront".

It came after MPs voted to exert more influence should the PM's deal fall.

Ministers will again battle to win over MPs to Theresa May's withdrawal deal after three government defeats.

Security will be the focus of the second of five days of debate in the Commons, where Tuesday's marathon session extended into the early hours.

Ahead of Prime Minister's Questions at noon, the government published its Brexit legal advice - a move which came after MPs voted to find the government in contempt of Parliament for ignoring a Commons vote demanding publication.

The PM's deal has been endorsed by EU leaders but must also be backed by the UK Parliament if it is to come into force. MPs will decide whether to reject or accept it next Tuesday, 11 December.

The UK is due to leave the European Union on 29 March, 2019. Ministers say that if MPs reject their deal they increase the chances of the UK leaving without a deal, or not leaving the EU at all.

Ministers will plough on with attempts to win over MPs on Wednesday, with eight hours of debate on the security and immigration aspects of the withdrawal agreement.

Meanwhile, Mrs May is expected to continue trying to convince small groups of her MPs to back the plan in private meetings.

Media playback is unsupported on your device Media caption The moment the government lost a key vote - and was told to disclose its legal advice on Brexit

Mrs May will face Labour leader Jeremy Corbyn at prime minister's questions, at noon, before the Brexit debate gets under way.

Warnings falling on deaf ears?

Senior Brexiteers in the cabinet have warned that the UK may not leave the EU if Mrs May's deal is voted down.

International Trade Secretary Liam Fox suggested the PM's deal was the only way of guaranteeing the UK leaves the EU, as scheduled, on 29 March 2019.

"When you are in prison and someone offers you a key, you take it," he told a committee of MPs.

While a no-deal exit would be "disorderly", he suggested the UK being kept in the EU against the will of the British people would be even more damaging.

"I think that there is a real danger that the House of Commons which has a natural remain majority may attempt to steal Brexit from British people which would be a democratic affront."

Environment Secretary Michael Gove said the deal on the table was in the best interests of the country.

"Everyone has to think at this momentous moment - do we want to ensure that Brexit gets over the line? Do we want to deliver on the verdict of the 17.4 million people who voted to leave the European Union because if we don't back the prime minister, we risk there being no Brexit and that I think would be a fatal blow to faith in democracy."

But a former Conservative chief whip has said he expects the PM to lose the vote.

Mark Harper, who backed Remain in the referendum told the Daily Telegraph he would vote against the withdrawal agreement, and predicted the deal would be rejected by 80 of his party colleagues.

He urged the prime minister to renegotiate the deal, insisting the current plan would leave the UK worse off.

Why did the defeats matter?

First, the government lost a bid to have the legal advice issue dealt with separately by the Privileges Committee of MPs.

In a second defeat, ministers were found in contempt of parliament and forced to concede they would have to publish that advice in full, having previously argued this would break convention and was not in the national interest.

Media playback is unsupported on your device Media caption BBC political correspondent Leila Nathoo explains how things unfolded

Most significantly, the third defeat was over changes to the parliamentary process in the event that the Commons votes down Mrs May's deal.

Instead of being confined to merely "taking note" of what the government tells them, MPs would also be able to exert more influence by voting on what they want the government to do next.

This could potentially see Parliament wrest control of the Brexit process from ministers if, as expected, MPs push for a "Plan B" alternative to Mrs May's deal and seek to prevent any chance of Britain leaving the EU without a deal in place.

Former Attorney General Dominic Grieve, who brought the motion, told Channel 4 News it would "allow the UK time to consider its options", including re-starting negotiations with the EU or giving the public the final say.

Liberal Democrat leader Sir Vince Cable said: "The Commons is now very likely to defeat the government again next week on the Brexit deal, at which point the country must be given a 'People's Vote', and asked to choose between the deal or remaining in the EU."

A glimmer of hope for the PM?

By BBC Political Editor Laura Kuenssberg

Former Remain rebels now have a possible route to get what they want if the PM's plan is rejected, as there is a possible - I emphasise the possible - way to get a vote with a majority for a Norway-style agreement or, less likely, a push for another referendum.

That won't go unnoticed by Brexiteers too, who may feel (some of them at least) that Mrs May's deal might be their best bet in that case, rather than risk that softer, squidgier Brexit.

It's possible therefore that Tuesday's shenanigans have made it less likely that the prime minister will face a terrible defeat next week because a few wobbly rebels on both sides might come in line.

Read more from Laura

How did the PM try to win over MPs?

Media playback is unsupported on your device Media caption Theresa May: "Worth taking a moment to reflect on how we got here."

When she finally kicked off the debate about the deal itself, Mrs May insisted the UK would enjoy a "better future" outside the EU.

She said the "honourable compromise" on offer was "not the one-way street" many had portrayed it to be and that the EU had made it clear that the agreement would not be improved on.

"I never said this deal was perfect, it was never going to be. That is the nature of a negotiation," she said.

"We should not let the search for a perfect Brexit prevent a good Brexit."

And what was the reaction?

Labour leader Jeremy Corbyn said it was a bad deal for the UK and that his party would seek a vote of no confidence in the government if it was thrown out by MPs.

"I hope and expect this House will reject that deal," he said.

"At that point, the government has lost the confidence of the House. Either they have to get a better deal from the EU or give way to those who will."

Media playback is unsupported on your device Media caption Not everyone agreed with Boris Johnson's analysis of the Brexit deal...

Nigel Dodds, leader of the DUP in Westminster, said the agreement "falls short" of delivering Brexit "as one United Kingdom" and would mean entering "a twilight world where the EU is given unprecedented powers over the UK".

Ex-Foreign Secretary Boris Johnson dismissed the deal as a "paint and plaster pseudo-Brexit" and said its supporters would be "turning their backs" on the 17.4 million Leave voters.

The leader of the SNP at Westminster, Ian Blackford, said the "cold, hard truth" was that the deal represented "a moment of self-harm in our history".

"It is not too late to turn back," he said. "Fundamentally, there is no option that is going to be better for our economy, jobs, and for our communities than staying in the European Union."

However, in closing the debate shortly after 01:00 GMT on Wednesday, Brexit Secretary Stephen Barclay argued the deal would bring "real changes which will improve the livelihoods of people up and down the country".