U.K. Prime Minister Theresa May suffered a defeat on her key Brexit legislation in the House of Lords on Monday, setting up a battle with the House of Commons later this week.

Lawmakers in the unelected upper house backed an amendment to ensure a "meaningful vote" for Parliament on any Brexit deal agreed with the European Union — or on what to do if there's no deal — 354-235.

The bill will now return to the Commons on Wednesday for what is expected to be a knife-edge vote that could determine the outcome of Brexit talks. Pro-European lawmakers in May's own party are planning to rebel against the government as they seek to prevent the no-deal Brexit scenario that businesses fear most.

The Lords vote, which was widely expected, inserts a clause into the bill that would give Parliament the power to direct the final stage of Brexit negotiations. Parliament — which backs a softer Brexit than the one being pursued by the government — would be able to block a 'no-deal' split.

"Ministers, the prime minister in particular, have promised a meaningful vote, that promise has not been honored," former minister Douglas Hogg, who sits in the House of Lords as Viscount Hailsham and introduced the amendment, told lawmakers. "If your lordships want Parliament to have a meaningful vote, Parliament must insist."

Brexit backers oppose the amendment, saying it strips the government of negotiating leverage if it can't walk away.

"To rule out 'no deal' as an option completely, even as a theoretical negotiating objective, places the government in an impossible position," former Chancellor of the Exchequer Norman Lamont told lawmakers.

The amendment to the European Union (Withdrawal) Bill would ensure an amendable motion would be put before Parliament after an agreement was reached with the E.U., allowing lawmakers to reject the deal and take control of the process. The government favors a motion that can't be amended, as that reduces lawmakers' clout.