OAKLAND — Living conditions at two Oakland apartment buildings were so dire for tenants that an Alameda County Superior Court judge granted a request by the Oakland city attorney to take away control of the building from the landlords and transfer it to a new operator to improve the residences.

The judge’s decision comes after Oakland City Attorney Barbara Parker filed a lawsuit earlier this year charging three landlords — King V. Chau, James H. Chau, and Judy N. Chau — with ignoring numerous city notices to fix the properties they owned on 1100 block of East 11th Street, the 1400 block of Eighth Avenue and the 1000 block of Foothill Boulevard.

The city’s attorneys allege that the property owners rented out illegally converted units, did not provide safety protections such as carbon monoxide or smoke detectors, created fire hazards through unapproved wiring, forced their tenants to live without power and gas, and then subjected tenants to repeated harassment, including one instance described in the lawsuit in which a tenant was locked out of the building and threatened by men hired by the owners.

While the owners have sold the Eighth Avenue building, the judge’s decision will put the other two properties at 1030 Foothill Blvd. and 1130 E. 11th St. into a receivership, in which a neutral third-party will take over the building operations and be tasked with remedying the conditions, according to court documents.

“The tenants and neighbors of 1030 Foothill and 1130 E. 11th Street are entitled to safe and habitable housing,” Parker said in a written statement about the court’s decision last week. “In the midst of a global pandemic and with winter upon us, there is even greater urgency to ensure Oaklanders’ basic rights are protected. The court’s ruling clearly recognizes these tenants’ and neighbors’ plights and grants them the immediate relief they desperately needed.”

The city had conducted 27 separate inspections and issued multiple notices of violation, an order to abate and red-tags formally declaring the property unsafe. Still, the city attorney alleged, the building owners did not comply to improve the conditions, which worsened over time: There were five fires at the two properties over the past few years, including one as recently as Nov. 23 at the Foothill property, according to court documents.

The tenants had no electricity or gas since at least then and were forced to cook using charcoal.

It’s rare that the city has to sue property owners to improve conditions for tenants.

According to the order issued by Superior Court Judge Brad Seligman, the landlord defendants had previously stated in court hearings they did not have the finances to improve the building conditions and there was no plan to do so other than selling the building. The proposed owners also offered no plan to remediate the buildings, the judge wrote.

Instead, the properties will go under the control of Gerard Keena II, president of a group called the Bay Area Receivership Group, who is tasked with making the necessary fixes, according to the court order.