LONDON (Reuters) - Prime Minister Theresa May’s government was defeated on Wednesday, when lawmakers forced through changes to its Brexit blueprint that ministers said could endanger Britain’s departure from the European Union.

In a blow to May, already weakened after losing her Conservative Party’s majority in a June election, the 650-seat parliament voted 309 to 305 in favor of an amendment to hand lawmakers more say over a final exit deal with the EU.

Up until the last minute of an often bitter debate in parliament, May’s team tried to convince lawmakers in her party to give up their demands and side with a government fearful that the move will weaken its hand in tough Brexit negotiations.

Members of Parliament (MPs) are debating the EU withdrawal bill, which will repeal the 1972 legislation binding Britain to the EU and copy existing EU law into domestic law to ensure legal continuity after ‘Exit Day’ on March 29, 2019.

In focus on Wednesday was an amendment put forward by Conservative lawmaker and former attorney general Dominic Grieve who wants parliament to have a meaningful vote on any deal before it is finalised and for it to be written into law.

“There is a time for everybody to stand up and be counted,” Grieve told parliament earlier, criticizing some fellow members of the Conservative Party for calling him a traitor over his decision to vote against the government.

He dismissed a last-minute pledge by justice minister Dominic Raab for government to write the promise of a meaningful vote into law later on its journey through both houses of parliament as coming “too late”.

The government was “disappointed” by the vote, a spokeswoman said in a statement, adding that “this amendment does not prevent us from preparing our statute book for exit day”.

But with May due at an EU summit on Thursday to encourage the other 27 leaders to approve a move to the second phase of Brexit talks and begin a discussion about future trade, the defeat comes at a difficult time for the prime minister.

In the European Parliament, which must also ratify any withdrawal treaty with Britain, its Brexit coordinator cheekily tweeted that his British counterparts had “taken back control” - a reference to the catchphrase of pro-Brexit campaigners.

“A good day for democracy,” added Guy Verhofstadt.

DEEP DIVISIONS

The EU withdrawal bill has been the focus of seven days of often bitter debate, underscoring the deep divisions over Brexit not only among the Conservatives but also in the main opposition Labour Party and across the country.

It has also highlighted May’s weakness.

In June, she gambled on a snap election to strengthen her party’s majority in the 650-seat parliament but instead bungled her campaign and ended up with a minority government propped up by the 10 votes of a small, pro-Brexit Northern Irish party.

Since then she has struggled to assert her authority over a Conservative Party which is deeply divided over the best route out of the EU.

“This defeat is a humiliating loss of authority for the government on the eve of the European Council meeting,” Labour leader Jeremy Corbyn said in a statement.

Britain's Prime Minister Theresa May leaves 10 Downing Street in London, December 11, 2017. REUTERS/Toby Melville

“Theresa May has resisted democratic accountability. Her refusal to listen means she will now have to accept Parliament taking back control.”

Earlier, May had tried to persuade lawmakers to vote with the government for her Brexit blueprint, saying Grieve’s amendment would put added time pressure on a government which wants to make Britain ready to leave the EU in March 2019.

“That could be at a very late stage in the proceedings which could mean that we are not able to have the orderly and smooth exit from the European Union that we wish to have,” she told parliament before an hours-long debate on the exit plan.

Her spokesman said the government had “in good faith come forward with a strong package of concessions to deal with the spirit of the amendment”.

Pro-Brexit lawmakers fear the amendment could force Britain to weaken its negotiating stance by offering parliament the opportunity of forcing ministers back to the negotiating table if it feels any final deal is not good enough.

Raab said that could convince the EU that Britain would not walk away from a bad deal.

“Actually if that looked likely we’d end up with worse terms, and we’d be positively incentivizing the EU to give us worse terms,” he told parliament.