"Tonight I put country and constituency before party and voted with my principles to give Parliament a meaningful vote," he tweeted.

The government said it was "disappointed" at losing its first defeat on Brexit despite the "strong assurances" it had offered.

Labour leader Jeremy Corbyn said the defeat was "a humiliating loss of authority" for Mrs May on the eve of an EU summit where leaders will discuss Brexit.

Conservative MPs clash

The defeat came after opposition parties joined forces with Conservative rebels during a heated debate in the Chamber on the amendment.

Critics accused those behind the amendment - which was authored by former attorney general Dominic Grieve and championed by other pro-Remain campaigners - of trying to "frustrate" Brexit and tying the government's hands.

After the result was announced, one of the rebels, former cabinet minister Nicky Morgan, tweeted: "Tonight Parliament took control of the EU Withdrawal process."

But other Conservative MPs reacted angrily, with one, Nadine Dorries, saying the rebels should be deselected.

What the vote was about

The UK is due to leave the EU in March 2019, and negotiations are taking place on what their relationship will be like in the future.

The EU Withdrawal Bill is a key part of the government's exit strategy.

Its effects include ending the supremacy of EU law and copying existing EU law into UK law, so that the same rules and regulations apply on Brexit day.

MPs have been making hundreds of attempts to change its wording - but this is the first time one has succeeded.

Unless the government manages to overturn it further down the line, it means a new Act of Parliament will have to be passed before ministers can implement the withdrawal deal struck with Brussels.

Ministers had made several efforts to placate the Conservative rebels, and argued that Mr Grieve's amendment would put unnecessary time pressure on the government if talks with the EU continued until the last minute.

They had already promised a vote on the final deal and to enshrine the withdrawal agreement in an Act of Parliament.

But critics demanded a guarantee of a "meaningful vote" before the deal is agreed. They said the wording of the bill would allow ministers to bypass Parliament in implementing what is agreed with Brussels.

And minutes before the vote, they offered a last-minute promise of action at a later stage of the bill's journey through Parliament.

Some Conservatives said this had changed their minds but Mr Grieve said it was "too late".

The reaction

Speaking afterwards, the government said: "We are disappointed that Parliament has voted for this amendment despite the strong assurances that we have set out.

"We are as clear as ever that this bill, and the powers within it, are essential.

"This amendment does not prevent us from preparing our statute book for exit day. We will now determine whether further changes are needed to the Bill to ensure it fulfils its vital purpose."

Justice Minister Dominic Raab said the defeat would not hold up the Brexit process.

"It's a setback but it's a fairly minor setback, it won't frustrate the Brexit process," he said, adding: "It's not going to stop us leaving the EU in March 2019."

Mr Corbyn said "Parliament has asserted itself" amid a "power grab" by the prime minister.

The European Parliament's chief Brexit co-ordinator Guy Verhofstadt tweeted: "British Parliament takes back control. European and British Parliament together will decide on the final agreement. Interests of the citizens will prevail over narrow party politics. A good day for democracy."