SAN FRANCISCO — A Newport Beach ordinance that restricts group homes for recovering addicts may have been motivated by illegal discrimination and may be challenged at trial, a federal appeals court ruled unanimously Friday.

The decision by the U.S. 9th Circuit Court of Appeal revived lawsuits against the city over a 2008 zoning ordinance that drove most group homes out of the city and forced others to limit services.

The law was seen as a model for other California communities grappling with complaints about group homes in residential neighborhoods.

"Obviously, this is a huge victory for sober-living homes and group homes," said Mary Helen Beatificato, chief executive of Morningside Recovery in Newport Beach. "This ordinance is going down, no doubt about it."

Morningside decided to move its 36 sober-living clients out of the city after an Orange County Superior Court judge ruled last month that the operator violated Newport Beach law.

Newport Beach passed the ordinance after residents complained that dozens of group homes had created parking, traffic, noise and second-hand smoke problems in residential neighborhoods. Most of the homes were located in the Balboa Peninsula and West Newport.

Bob Rush, a West Newport resident who has been fighting to limit group homes since 2006, called the allegation of discrimination "laughable."

He said he once counted 15 group homes on his eight-block street.

"I saw one day there was a group of guys standing in front of a house to be picked up by a bus, and two guys were wearing L.A. Jail orange jumpsuits," Rush said.

Operators of the homes challenged the ordinance in district court and lost. Friday's decision made it possible for homes that have lost business or closed to collect substantial financial compensation.

Elizabeth Brancart, an attorney for three group homes, said they hope the law will be overturned. She said other cities eager to clamp down on group homes have been monitoring the litigation.

"This will give them pause," Brancart said. "Even if the laws are neutral on their face, if they are clearly targeted at particular groups for discriminatory purposes, the neutrality of the language of their laws won't save them."

Newport Beach City Attorney Aaron Harp said the ruling would force the city to go to trial unless the City Council decides to appeal. Harp said the ordinance was adopted in a "fair process" after multiple public hearings.

"In Newport we treat people with disabilities better than we treat any other group," Harp said. "We don't allow boarding houses, sororities or fraternities in residential zones, and here we made an exception."

But the 9th Circuit cited pages and pages of evidence that suggested the law was intended to make group homes for recovering addicts unwelcome.

The district court mistakenly disregarded evidence that the city's "sole objective in enacting and enforcing its ordinance was to discriminate against persons deemed to be disabled under state and federal housing discrimination laws," Judge Stephen Reinhardt, a Carter appointee, wrote for the 9th Circuit.

Although the law affected boarding houses, sororities and others, evidence suggested it was aimed at group homes, the court said.

"It appears either to be the case that very few 'group residential' facilities that were not group homes existed when the ordinance was enacted, or if such facilities existed, the city did not enforce the ordinance against them," wrote Reinhardt, joined by Chief Judge Alex Kozinski, a Reagan appointee, and Judge Sidney R. Thomas, appointed by former President Clinton.

Costa Mesa is in the process of approving its own ordinance that could address problem properties like rehab homes or motels by broadening the definition of a public nuisance.

Beatificato said the city's wider approach could avoid accusations that officials targeted a specific group.

"I actually like the approach — assuming it's done in a constitutional way — that Costa Mesa is going toward," she said.

Since Newport Beach enacted its ordinance, group homes sharply declined from 73 homes in April 2007, to 27 homes providing 329 beds now.

Some are licensed to treat recovering alcoholics and drug addicts. Others simply provide a temporary place for recovering addicts to live after treatment. All residents are required to maintain sobriety.

The 9th Circuit said the city "created a task force to locate group homes, undertake surveillance of them, and enforce the zoning code strictly against them."

Dolan writes for the Los Angeles Times and can be reached out maura.dolan@latimes.com.