The House of Lords voted yesterday 358 to 256 for an amendment requiring ministers to protect the rights of EU nationals based in the UK following Brexit.
However, the government's defeat in the Lords could prove a symbolic one as MPs can remove the amendment when it comes back to the House of Commons.
The Department for Exiting the EU said: "We are disappointed the Lords have chosen to amend a bill that the Commons passed without amendment.
May has said that any guarantee of the rights of EU nationalsmust be part of a deal protecting UK expats overseas.
More From This Section
The amendment backed by the Lords requires the government to introduce proposals within three months of Article 50 to ensure EU citizens in the UK have the same residence rights after Brexit.
May has set an end of the month deadline to invoke Article 50 of the Lisbon Treaty, which will trigger the two-year deadline for Brexit negotiations.
The government is said to be confident of defeating the changes to the bill in the Commons.
Jeremy Corbyn, the Opposition Labour leader who ordered his MPs to support the bill unamended when it went through the Commons, described the result of the Lords vote as "great news", raising the possibility that he might tell his MPs to back the amendment in the Lower House.
"The Government must now do the decent thing and guarantee the rights of EU citizens living in the UK," he said.
The amended bill will return to the House of Commons on March 13 and 14, when MPs will debate whether to keep the changes.