Facing a court-imposed deadline, French lawmakers have approved a measure that allows detention for asylum-seekers and their families, and limitless house arrest for foreign convicts who cannot be expelled.

In a contentious late-night vote Thursday, President Emmanuel Macron’s majority party pushed the measure through, despite reservations from many members. Jacqueline Gourault, of the Interior Ministry, said France had become a “rebound country” and that the measure was urgently needed before the June deadline.

France’s high court ordered lawmakers in September to come up with a definition of when asylum-seekers should be considered a flight risk and therefore could be detained along with their families. A second court ruling in favor of a convicted terrorist who has been held under house arrest since being freed from prison in 2008 added pressure.