Detained immigrants with health issues that render them mentally incompetent are now guaranteed legal counsel.

Being implemented this week, the new federal policy comes after a yearlong legal fight over a lawsuit filed in Los Angeles led by the American Civil Liberties Union.

"Providing legal representation to people with significant mental disabilities is not only legally sound, but also the only humane way to run our immigration system," said Ahilan Arulanantham, an attorney with the ACLU of Southern California and the ACLU Immigrants' Rights Project.

About 34,000 immigrants are detained daily and more than 1,000 of them have mental disabilities of some kind, according to the ACLU.

In 2010, the ACLU won a right to representation for two mentally disabled men who spent years in custody. Both were legal residents facing deportation after criminal convictions.

The lawsuit was filed by José Antonio Franco-Gonzalez, a Mexican immigrant with a cognitive disability who was detained in federal immigration facilities for nearly five years without a hearing or a lawyer. The Costa Mesa man, now 33, was forced to represent himself even though he functions at the mental level of a child and cannot tell time or remember his birthday.

That year the lawsuit was expanded to class-action status, and U.S. District Court Judge Dolly M. Gee ruled in the ACLU's favor Tuesday. According to the ACLU, it applies to certain detainees now held in Arizona, California and Washington.

The Department of Justice and Department of Homeland Security’s new policy includes competency hearings for detainees and a screening process for serious mental disorders.

A qualified representative will be made available to unrepresented detainees deemed unable to represent themselves, federal officials said.

The new procedures are expected to be fully implemented across the country by the end of this year.

The ACLU was aided in the case by Public Counsel, the Northwest Immigrant Rights Project, Mental Health Advocacy Services and the law firm of Sullivan & Cromwell.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino