Hundreds of immigrants with mental disabilities who were deported from the U.S. after representing themselves in court may be allowed to return to the country under a settlement approved by a judge Friday.

Federal Judge Dolly M. Gee's ruling will let immigrants with serious mental disabilities request to have their cases reopened in hopes of returning to the U.S. The ruling covers immigrants deported from California, Arizona and Washington between Nov. 21, 2011 and Jan. 27 this year.

"This is really a historic settlement," said Carmen Iguina, staff attorney for the ACLU of Southern California, one of the groups that filed the 2010 lawsuit that led to the settlement.

"We're really happy that our class members are going to be able to go back to their communities and families and follow up their cases here," Iguina said.

The government identified 900 immigrants who could benefit from the ruling, though there could be more and it's unclear how many would qualify to have their cases reopened, Iguina said.

Many of those affected are Latino, but she said there's no way to know exactly how many.

Under the agreement, the federal government said it will help those with reopened cases return to the U.S. and pay for some transportation costs.

The settlement comes after an April 2013 injunction that found immigrants with serious mental disabilities have a right to an attorney if they're found mentally incompetent to represent themselves. An October 2014 order then required the federal government to establish screening procedures to determine immigrants' mental competencies. Those procedures took effect in January.