SAN FRANCISCO - A federal appeals court on Thursday struck down a 31-year-old Los Angeles law that bars people from living in parked vehicles, saying the vaguely written statute discriminates against the homeless and poor.

The ruling by a three-judge panel of the 9th U.S. Circuit Court of Appeals involved a 1983 law that prohibits the use of a vehicle "as living quarters either overnight, day-by-day, or otherwise."

The court said the law was unconstitutional because its ambiguous wording does not make clear what conduct would constitute a violation and "criminalizes innocent behavior."

Get Breaking News Delivered to Your Inbox

The decision came in a case brought on behalf of four people who were cited and arrested in the Venice area by Los Angeles police officers who concluded the numerous belongings in their RVs and cars meant they were violating the law.

"Is it impermissible to eat food in a vehicle? Is it illegal to keep a sleeping bag? Canned food? Books? What about speaking on a cellphone? Or staying in the car to get out of the rain?" Judge Harry Pregerson wrote for the panel. "These are all actions plaintiffs were taking when arrested for violation of the ordinance, all of which are otherwise perfectly legal."

The officers were part of an LAPD homelessness task force charged with enforcing the ordinance in response from community complaints about people living in their cars.

The panel's ruling overturned a lower court judge who had sided with the city and dismissed the case without a trial.

Carol Sobel, the lawyer for the three men and one woman who sued to overturn the law in 2011, said Los Angeles' ban on living in cars was exceptionally broad. One of her clients was cited while waiting outside a church that served meals and another while driving her RV through Venice on her way to sell her work at a local art fair.

Even so, the ruling might force other western cities within the 9th Circuit's territory to amend statutes that outlaw sleeping in vehicles, Sobel said, citing the city of Palo Alto as an example.

"People living in their vehicles is one of the great unidentified homeless groups in this country - formerly middle-class people who lost everything during the recession and are trying to maintain the appearance of stability so they can go to work," she said.

Los Angeles City Attorney Mike Feuer, whose office defended the law before the 9th Circuit, said the city would not appeal. Instead, Feuer said he would work with other officials to write a replacement ordinance "that respects both the rights and needs of homeless individuals and protects the quality of life in our neighborhoods."

"We need to make a break from the past, recognize that the civil and criminal justice systems alone can't effectively address homelessness, and commit ourselves to grappling with the issues that create homelessness in the first place," he said.

Pregerson did not make clear in the panel's opinion what, if anything, city lawmakers could do to make the law pass constitutional muster.

"The city of Los Angeles has many options at its disposal to alleviate the plight and suffering of its homeless citizens," he wrote. "Selectively preventing the homeless and the poor from using their vehicles for activities many other citizens also conduct in their cars should not be one of those options."