Media playback is unsupported on your device Media caption Laura Kuenssberg reports on Wednesday's vote

The government will "resist" any changes to its Brexit bill and seek to overturn the defeat inflicted by the House of Lords, ministers have vowed.

Peers defied ministers by 358 to 256 to guarantee the rights of EU nationals living in the UK after Brexit.

The government said it was "disappointed" at the first defeat for its draft legislation.

MPs will have the chance to remove the Lords' amendment when the bill returns to the House of Commons.

Before then, next Tuesday, the Lords will consider backing other possible amendments to the bill, which authorises Theresa May to trigger Brexit.

Leader of the Commons David Lidington told MPs on Thursday the bill was a "straightforward" one giving the PM the power to trigger the two-year Article 50 process of leaving the EU.

"And we will therefore seek to resist changes that would make that negotiating task more difficult," he said.

The vote came after a heated debate in the Lords where the government was accused of treating EU citizens like "bargaining chips".

Ministers attempted to stave off defeat, saying the issue was a priority for the government but should be tackled as part of a deal that also protected UK expats overseas.

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.

The Department for Exiting the EU said: "We are disappointed the Lords have chosen to amend a bill that the Commons passed without amendment.

"The bill has a straightforward purpose - to enact the referendum result and allow the government to get on with the negotiations."

The government said its position had "repeatedly been made clear", saying it wanted to guarantee the rights of EU citizens and British nationals "as early as we can".

Brexit Secretary David Davis said ministers had hoped to secure agreement on the issue at the European Council in December "but we couldn't get everybody to agree at that point".

Now what? Analysis by Laura Kuenssberg, BBC political editor

Government sources tonight sound relaxed.

They knew this vote was likely to go against them. And it's an issue that the government believes it has a clear defence on.

Indeed, even during Theresa May's leadership campaign before she moved into Number 10, she articulated the same position. In her view, it would be unwise to guarantee the rights of the three million or so EU citizens in this country, before other EU countries are ready to do the same for British citizens abroad.

For her opponents that's distasteful, immoral even, because many people who have made their lives in the UK could be used, so the phrase goes, as "bargaining chips" in a negotiation.

There is little sign however of the government giving way despite the defeat.

Read the rest of Laura's blog

Former Lords leader Lord Strathclyde said the vote represented "wrong-headed and muddled thinking".

He said it was difficult to see where a compromise between the government's position and that taken by the Lords could be found.

Media playback is unsupported on your device Media caption Lord Strathclyde: "We've turned British citizens living in the EU into bargaining chips"

Crossbencher Lord Kerslake, a former head of the civil service, said the vote showed that the Lords overwhelmingly felt the rights of EU citizens in the UK was an issue that should be sorted out now.

He told BBC One's Breakfast that while the government had given assurances that it wanted to resolve the matter as soon as possible, there was a risk it could take two years if the EU decided it wants all issues included in a single deal.

Crossbencher Baroness Meacher said she understood there were at least 30 Conservative MPs who would vote to support the amendment in the Commons, even though she anticipates Tory whips will "work extremely hard with all sorts of bribes to get these people to vote with the government".

Labour's shadow Lords leader Baroness Smith said there was a "moral", a "legal" and a "pragmatic" case in favour of guaranteeing EU nationals' rights.

Media playback is unsupported on your device Media caption Baroness Smith: "People are not bargaining chips"

Media playback is unsupported on your device Media caption Lord Howard: Peers must face up to 'unpalatable truth'

Seven Conservative peers voted in favour of the amendment, which was proposed by Labour with the support of the Liberal Democrats.

Shortly after the Lords vote, MEPs in the European Parliament debated the status of EU migrants in the UK.

Justice Commissioner Vera Jourova told MEPs that EU citizens in the UK and British citizens elsewhere in the EU "deserve to know what their rights will be" after Brexit.

She said the matter should be addressed "as soon as possible" but that negotiations could only begin after the UK has triggered Article 50.

The stages the Brexit bill needs to go through to become law:

(It is currently at committee stage in the House of Lords)