Rishi Sunak suffered a setback to his plans to deport some asylum seekers to Rwanda after parliament’s upper house backed a largely symbolic motion to delay ratification of a treaty aimed at overcoming a legal block.

Under the Rwanda plan, which has yet to be carried out, asylum seekers who arrive on England’s southern coast in small, inflatable boats would be sent to Rwanda.

Britain signed a treaty last year with Rwanda to overcome resistance from the courts, who have ruled the plan unlawful and agreed to address safety concerns. The government is trying to pass legislation through parliament to block legal challenges to deportations.

Although ministers could take steps to ignore the motion, lawmakers in the House of Lords backed it 214 votes to 171, providing the first public indication of the scale of opposition to the government’s new legislation in the upper chamber.

Peter Goldsmith, an attorney general under former Prime Minister Tony Blair, who laid the motion, said before the vote it was the first time lawmakers in the Lords had used parliamentary powers to vote to halt the treaty ratification.

Sunak has said he wants the first deportation flights to leave in the next few months – ahead of a general election expected in the second half of this year – so he can meet one of his five pledges to “stop the boats”.

The government passed the Rwanda legislation in the House of Commons last week after days of debate that showed deep divisions in the governing Conservative Party.

The level of opposition in the House of Lords is expected to debate the bill for the first time at the end of January, with crunch votes likely to come in March.

The Lords are likely to make amendments to the legislation and could, in extreme circumstances, delay the bill for a year, which would mean it could not be passed until after the next election.