Theresa May has suffered an extraordinary three parliamentary defeats in a single day, as rebellious MPs at Westminster sought to wrest back control of Brexit.

The start of a five-day debate on May’s deal was delayed by several hours, as MPs passed a historic motion finding the government in contempt of parliament for failing to publish in full the legal advice on Brexit.

The shadow Brexit secretary, Keir Starmer, called the defeat a “badge of shame” for the government.

“By treating parliament with contempt, the government has proved it has lost its majority and the respect of the house. The prime minister can’t keep pushing parliament away or avoiding responsible scrutiny,” he said.

MPs had already voted down a government compromise, which would have referred the dispute to parliament’s privileges committee, delaying it until after next week’s crunch vote on May’s deal.

With the prime minister still waiting to open the formal debate, MPs then inflicted a third defeat, passing a cross-party amendment tabled by MPs including Dominic Grieve aimed at strengthening the hand of parliament if the deal is voted down.

Backers of a softer Brexit – or a second referendum on May’s deal – cheered the move, which they hope will allow them to demonstrate parliament’s support for alternatives to May’s approach.

Quick guide What is the common market 2.0/Norway-plus Brexit option? Show Hide This soft Brexit compromise has been championed as a plan B for leaving the European Union. It is based on Norway’s relationship with the EU, which is outside the bloc and the customs union but inside the single market. Under the plan the UK would have to join Norway, Liechtenstein and Iceland in the European Free Trade Association (Efta), which would then allow it to participate in the European Economic Area (EEA). The ‘plus’ in this option refers to a temporary customs union with the EU, which would need to be negotiated to avoid a hard border on the island of Ireland. This arrangement would remain in place until the EU and UK agreed a specific trade deal. The option has the advantage of being as close to the EU as possible without full membership, and it would do away with the need for the problematic backstop for Northern Ireland. Like Norway, the UK would be outside the common fisheries and agriculture policies, and would not be subject to the European court of justice. But it crosses a key red line for Brexiters by continuing freedom of movement, one of the preconditions of single market membership. It would also limit the UK's ability to negotiate its own trade deals while a new customs arrangement is under discussion. And it would require continued financial contributions to the EU without an influence, as the UK would no longer have MEPs or a seat on the European Council. It also isn't entirely clear that the UK would be welcomed into Efta.

Grieve said: “MPs are tonight starting the process of taking back control. No longer must the will of parliament – reflecting the will of the people – be diminished. Parliament must now take back control and then give the final decision back to the public because, in the end, only the people can sort this out.”

Grieve’s amendment was supported by the Democratic Unionist party and by 26 Tory rebels, including several former cabinet ministers, some of them erstwhile loyalists, such as Damian Green and Michael Fallon. The government lost by 321 votes to 299.

Asked if May still commanded a majority in parliament, a No 10 source said: “Everybody knows the parliamentary arithmetic but during the course of this administration, we have won the overwhelming majority of the votes taking place.”

May went on to open the debate with a defiant speech, which some at Westminster said sounded like a first draft of her own political obituary, with the future of her government in doubt.

“I have spent nearly two years negotiating this deal. I have lost valued colleagues along the way. And faced fierce criticism from all sides,” she said.

“If I had banged the table, walked out of the room and at the end of the process delivered the very same deal that is before us today, some might say I had done a better job. But I didn’t play to the gallery, I focused on getting a deal that honours the referendum and sets us on course for a bright future – and I did so through painstaking hard work.”

Doggedly vowing to plough on with her controversial EU deal, the prime minister insisted there was no alternative that could command public support – and warned that rejecting it would be risky. “This argument has gone on long enough, it is corrosive to our politics and life depends on compromise,” she said.

Facebook Twitter Pinterest Jeremy Corbyn. Photograph: HO/AFP/Getty Images

The Labour leader, Jeremy Corbyn, replying to the prime minister, dismissed the political declaration accompanying the 585-page withdrawal agreement as “a very vague wish list.”

“We still don’t know what our long-term relationship with Europe would look like and that’s why so many MPs across parliament are not willing to vote for this blindfold Brexit and take a leap in the dark about Britain’s future,” he said.

May faced a series of hostile interventions from her own side, with the former foreign secretary Boris Johnson, who resigned in protest at her deal in July, calling it “a national humiliation, that makes a mockery of Brexit”.

“We are going to be rule-takers; we are going to be a de facto colony – and out of sheer funk we are ensuring we will never, ever be able to take advantage of the freedoms we should have won through Brexit,” he warned.

Play Video 0:44 'What's his big idea?': Sir Roger Gale lambasts Boris Johnson during speech – video

Brexiters remained defiant, despite the passage of the Grieve amendment. The former Department for Exiting the EU minister Steve Baker, who vainly sought to spearhead a no confidence motion against May last month, insisted motions passed by MPs in the wake of the deal being rejected could not be binding.

Privately, pro-Brexit sources suggested they would be content if May’s deal is rejected by a margin of at least 50 votes.

While the government opposed the Grieve amendment, Downing Street hopes it will focus the minds of pro-Brexit MPs, by increasing the likelihood that the defeat of May’s deal next week would result in a fresh referendum.

With just a week to go before Tuesday’s vote, May is expected to spend time meeting colleagues individually in a bid to win them over.

The government is also making fresh efforts to woo the DUP by offering further reassurances over access to the mainland’s market if the prime minister’s deal is voted through.

“We are talking about unilateral commitments we can give in the House of Commons to provide reassurance in relation to providing access to the GB market,” a Downing Street source said.

Earlier, as Labour MPs heard they had defeated the government in the contempt motion, a loud cheer went up, with one opposition backbencher shouting: “Beginning of the end!”

The attorney general, Geoffrey Cox, had argued that the public interest did not permit the publication of the legal advice and instead published a summary and took questions in the House of Commons on Monday.

During the debate, Starmer said the government was “wilfully refusing” to comply with a binding order to release the legal advice on its Brexit deal, putting it in contempt of parliament.

Downing Street sources later sought to clarify reports that May would publish the legal advice on Wednesday, indicating that while the government will respond to the contempt vote, it might not publish the advice within 24 hours. “The legal advice will be published. The government will respond tomorrow,” one said.