The Knesset approved a bill on Monday easing detention procedures for African migrants, but also designed to encourage those in the country to leave voluntarily.

The bill passed with 47 votes in favor and 23 against in the last order of business before the Knesset dissolved itself to pave way for new elections.

The new rules, which will amend an existing law meant to curb the influx of African migrants into Israel, were drafted by the Interior Ministry after months of negotiations following the High Court’s decision to strike down the existing law.

Get The Times of Israel's Daily Edition by email and never miss our top stories Free Sign Up

The law’s new language will limit the amount of time migrants can be held in the Holot detention facility to 20 months, and lower the number of times people need to be present at the facility for roll call from three times a day to once.

Had the legislation not passed before the Knesset dissolved, the ministry would have been forced by the court to free all 2,500 migrants being held at the southern Holot facility.

This is the third version of the bill, after two previous ones were struck down by the High Court of Justice. The first version was scrapped in September 2013 after the court ruled unanimously that the law, which had an amendment allowing the state to detain illegal migrants for up to three years without charging them with a crime, was unconstitutional.

In September this year, the court repealed the amendment to the Prevention of Infiltration Law for a second time.

Judges claimed the Holot facility was reminiscent of a prison and not — as the Israeli government presented it — an “open facility.” The court granted the government three months to find an alternative policy before it completely repealed the law, which would have forced the government to release all the currently detained migrants.

The legislation that passed Monday will also ease restrictions on newly apprehended migrants, limiting their incarceration to three months, down from one year, after which they will be transferred to Holot.

The rules also impose stiffer fines on those who employ illegal immigrants and forcing employers of permit-holding asylum seekers to garnish the workers’ wages, and only return the money upon their departure from Israel.

Since 2006, some 50,000 Eritreans and Sudanese have entered Israel illegally via the Sinai desert, prompting authorities to construct a fence along the border and build the large Holot detention facility in the Negev desert to house them.

For the past eight years, Israel has struggled to establish and implement a clear legal framework to deal with the influx of migrants, many of whom settled in South Tel Aviv, which has resulted in confusing and often conflicting ad hoc immigration policies.

Likud MK Miri Regev, who heads the Knesset Internal Affairs and Environment Committee and has championed the bill, said Monday she “wanted to bring [good] news to the residents of South Tel Aviv, to look them in the eye and tell them that Holot will not be shut on my watch.”

She expressed her disappointment on Monday that the final version of the bill was too weak. “The proposal as it came is bad and is with one eye on Geneva,” she said.

Regev, who has been a harsh critic of the High Court over the migrants issue, added that she regretted having to make compromises on the bill in order to squeeze it through before the dissolution of the Knesset later Monday.

The Likud MK had wanted to increase the initial incarceration period to six months and the holding period in Holot to 24 months.

“Israel cannot allow the Holot detention facility to close and for thousands of infiltrators to descend on South Tel Aviv. [This is why] I decided, with a heavy heart, to make compromises,” Regev said, adding that she would do everything in her power in the next Knesset to urge the government to form a clear and coherent immigration policy.

Opposition lawmakers blasted the bill, contending that it is an anti-democratic and unconstitutional law and arguing that this third version will be struck down by the High Court, as were the two before it.

Earlier, Interior Minister Gilad Erdan said that “the debate here is between two political groups — those who see Israel first of all as the one and only country of the Jewish people; and the left wing that, to my regret, is prepared to endanger that.”

Tamar Pileggi and AP contributed to this report.