* Court strikes down law meant to deter illegal immigration
* Human rights groups hail move, rightists angered
* State has 90 days to decide fate of hundreds of inmates
By Allyn Fisher-Ilan
JERUSALEM, Sept 16 (Reuters) - Israel's supreme court on Monday struck down a year-old law that meant African migrants could be held in detention for up three years without charge.
The law, that came into force in June last year, was meant to deter illegal immigration but was condemned by human rights campaigners as a harsh and illegal way of treating people, especially those fleeing persecution and seeking asylum.
A right-wing lawmaker said the court's ruling risked damaging the character of Israel - a state built on Jewish immigration - by opening the door to more Africans.
Chief Justice Asher Grunis said the law contradicted Israel's legal guarantees of basic democratic freedoms, and "therefore, it ought to be cancelled".
Grunis called the three-year term of detention "illegitimate constitutionally" and noted few inmates would have been likely to be released early as Israel would be unable to deport them to their countries of origin, mostly Eritrea and Sudan.
The court's nine-judge panel gave the state up to three months to decide the fate of hundreds of migrants held under the law in desert detention centres.
More than 50,000 African migrants have entered Israel since 2006, many receiving temporary permits to live in impoverished parts of Tel Aviv, a situation that has aggravated social tensions.
Yariv Levine, a senior lawmaker in Prime Minister Benjamin Netanyahu's right-wing Likud party, accused the court on his Facebook page of making a "mad decision to turn Israel from a Jewish state into one of all its immigrants".
Netanyahu said he would seek ways to observe the court's decision while "implementing our determined policy that has already curtailed the infiltration," and, he said, encouraged thousands of migrants to leave.
Liberal legislator Michal Rozin, chairwoman of a parliamentary committee on foreign workers, called the court ruling a welcome move "to stop anti-democratic legislation" and hoped it heralded a change in Israeli policy toward asylum seekers.
The government says most Africans reaching its borders are economic migrants rather than asylum seekers. Rights groups accuse it of being slow to review requests for refugee status.
Many Eritrean migrants say they have fled political repression, while many Sudanese say they have escaped civil strife, mostly in the Darfur region.
A newly fortified border fence with Egypt has effectively halted the arrivals across a once porous frontier, with government figures showing none having crossed since August after a peak of more than 2,000 a month in late 2011.
Interior Minister Gideon Saar said a month ago that Israel was seeking an arrangement to deport most of the Africans to another country, which an Israeli lawmaker confirmed to Reuters was Uganda.
Uganda's Foreign Ministry has denied having agreed to absorb any African migrants from Israel. (Editing by Robin Pomeroy)