British Prime Minister Theresa May has suffered an early defeat to her Brexit plans, after parliament demanded the government come up with a plan B if her Brexit deal is voted down.

With less than three months before Britain is due to leave the EU, parliament has begun a five-day battle over Ms May’s Brexit plan, set to culminate in a vote by MPs next Tuesday.

Ms May has refused to retreat from her unpopular deal, which envisages close trading ties with the EU after leaving in March.

She is pressing ahead with a vote that she looks set to lose, after failing to win over her nominal Northern Irish allies.

Losing the vote would deepen uncertainty over the future of Brexit, Britain’s biggest shift in foreign and trade policy for more than 40 years. There are several possible outcomes, ranging from a disorderly exit to another referendum.

MPs voted 308-297 on Wednesday in favour of demanding the government come up with an alternative plan within three working days after Tuesday’s vote, rather than a planned 21-day limit, in a non-binding motion that nonetheless piles pressure on the government.

There were turbulent scenes in parliament when some in Ms May’s Conservative Party accused the speaker of bias.

Responding to the vote, Brexit minister Stephen Barclay told parliament it was the government’s intention to act quickly if it lost Tuesday’s vote. “I also want to reassure colleagues that whatever the outcome of this debate, we will respond rapidly, recognising that we must provide parliament with as much security as possible,” Mr Barclay said.

Earlier on Wednesday, Ms May called on parliament to back her deal. She suggested she was confident of getting further assurances from the EU to ease their concerns and offering Northern Ireland more control over the “backstop” arrangement to prevent the return of a hard border with EU member Ireland.

“These discussions have shown that further clarification over the backstop is possible and those talks will continue over the next few days,” she said.

The government also offered a concession to the Democratic Unionist Party, saying Northern Ireland would have “a strong role” in any decision between triggering the backstop or extending a transition period if a future relationship with the EU is not in place by December 2020.