TEL AVIV – Israel’s Supreme Court on Monday ruled that the state may deport illegal immigrants to a third country with consent, but added that the government cannot detain those who refuse to go for more than 60 days.

The court rejected a petition by human rights groups against deportation with consent. The judges stressed that the third country must be deemed safe. In addition, the government is banned from jailing those who refuse to leave for more than two months.

Until now, Israel had imprisoned illegal immigrants for up to 12 months.

At a protest outside High Court Chief Justice Miriam Naor’s home in Jerusalem over the weekend, demonstrators said that the illegal immigrants have been suffering at the hands of the authorities for close to a decade.

Several Israeli officials said that the new law should be amended to include the right to deportation without consent.

“The High Court removed from the state the ability to pressure the illegal infiltrators,” said Justice Minister Ayelet Shaked. “It turned the [migrant’s] lack of cooperation into a reward. We will fight this until we achieve the necessary results.”

Prime Minister Benjamin Netanyahu said the immigration policy rests on three things.

“We will need to pass a new law that will permit us to enforce these agreements,” he said, in reference to deals struck with third party African nations that will absorb the deported illegal immigrants. He added that the other two measures include the fence built on Israel’s southern border preventing infiltration and the issue of enforcement.

The Israeli Immigration Policy Center, which has lobbied to deport illegal immigrants, welcomed the ruling.

The group’s spokesman Yonatan Jakubowicz said the ruling was “very positive” and further called on the government “to act swiftly in order to advance an amended agreement to deport the infiltrators who have no legal or moral grounds to stay in Israel.”

According to the African Refugee Development Center, some 46,437 Africans have sought asylum in Israel. The majority, 73%, are from Eritrea, and around 19% are from Sudan. Israeli authorities maintain that there are 40,000 illegal migrants in Israel, most of whom are economic migrants and not refugees seeking sanctuary.