In its last session before dissolving itself this week, the Knesset passed a new version of the "infiltrators law", which has twice been ruled unconstitutional by the Supreme Court.
The new law, which will allow for the Holot detention centre to remain open, was pushed through the Knesset at the last moment with a 47-23 majority, even though some Labour members claimed later they voted "for" by mistake.
The law will allow authorities to hold illegal migrants in Saharonim prison for three months, and then in Holot open detention centre for up to 20 months.
Under the new law, the inmates will only have to be present for a head count once a day - instead of three times - but will still be forbidden from working.
MK Miri Regev, who proposed the new law, said she would have liked to present a much tougher bill, but had to make do with a "sterile law" in order to allow Holot to remain open during the election period.
She criticised Attorney General Yehuda Weinstein who had insisted on a watered-down version of her law "for looking towards Geneva and being disconnected from what is happening to the Israeli public".
Ms Regev promised to bring a tougher law to the new Knesset with a proposal that would override the Supreme Court. The court had ruled that the previous versions - which allowed for the imprisonment without trial of migrants for up to three years (and then one year) - were unconstitutional.
Meretz MK Nitzan Horowitz attacked the law, saying that its supporters "don't understand that in a democratic state, you can't put people in prison without trial. It doesn't matter if their black from Africa, blonde from Sweden, from Tel Aviv or Yeruham."
The human rights groups campaigning on behalf of the migrants are planning to take an appeal against the law back to the Supreme Court.