JERUSALEM (JTA) — Israel’s Supreme Court struck down an amendment to a law allowing the state to hold illegal migrants for up to three years without trial.

In an unanimous vote, the nine justices on Monday deemed that the amendment to the Law for Prevention of Infiltration, which went into effect in June 2012, was unconstitutional. They also ruled that it violates the right to liberty.

The judges gave the state 90 days to examine the cases of nearly 2,000 African migrants who are being held in Israeli detention centers under the amendment. The migrants could be entitled to release under the Law of Entry, which does not allow the state to detain people who are not under deportation proceedings.