The city of Oakland should have shut down or ordered repairs to a Fruitvale district live/work warehouse before 36 people were killed in a fire in 2016, a California judge ruled this week. Alameda County Superior Court Judge Brad Seligman found the San Francisco Bay Area's third-largest city had a "mandatory duty" to rehabilitate or raze the warehouse, which had been converted to a live/work space without permits, once it was aware of the hazards.

"There is no question of the authority and obligation of the city to act when faced with an unsafe and substandard building," Seligman ruled.

The decision kept Oakland as a defendant in a lawsuit brought by families of the victims seeking damages for wrongful death and injury, but the city is expected to appeal.

The lawsuit also names the owner of the warehouse, the managers of the Ghost Ship facility, the local electric power company, and more than a dozen others. One defendant, a co-sponsor of the performance on the night of the fire, was dismissed from the case.

The so-called Ghost Ship was home to dozens of artists, mostly young people, who built makeshift living spaces out of found objects and carpets, and powered their electric lights, cooking equipment and amplifiers using extension cords attached to another building nearby.

The Ghost Ship, believed to be one of perhaps dozens of illegal live/work facilities in Oakland, featured a performance stage on the second floor.

In fact, it was during a Dec. 2, 2016, musical presentation that the fire broke out. Investigators from the Oakland Fire Department and U.S. Dept. of Alcohol, Tobacco, Firearms and Explosives were unable to determine exactly why or where the fire started.

But the blaze apparently spread quickly through the crowded warehouse, trapping concertgoers on the second floor where many bodies were found. The main access to the second floor was a makeshift stairway of wooden pallets that quickly collapsed, and a second stairway was behind a partition and could not be easily located, especially after the jury-rigged lighting system failed.

Dozens of artists rented spots to live and work in the two-story warehouse at 1305 31st Ave. But the building, in Oakland's working class Fruitvale District, had not been inspected by the city for more than 30 years, despite numerous visits by police and firefighters, according to the San Francisco Chronicle newspaper.

At issue was whether those visits and others by social workers were enough to give the city notice of hazardous conditions at the Ghost Ship warehouse, and Judge Seligman concluded it was, even if there had been no formal inspection. Standard governmental immunity did not relieve the city of its duty to act in a dangerous situation, the court said.

Next up in the civil case is a decision on whether the county of Alameda, where Oakland is located, also may be liable for the loss of life.

Criminal proceedings against master tenant Derick Almena and his assistant are still pending. They have pleaded not guilty to all charges.

All 36 victims, who ranged in age from 17 to 61, died of smoke inhalation, according to the Alameda County coroner's office.