Just when it seemed the legal fight over Noble Drew Ali Plaza couldn’t get more confusing, lawyers for the city Department of Homeless Services are looking to jump in the fray.

The city is worried that a suit brought by the Legal Aid Society on behalf of tenants might result in the displacement of 180 homeless families who live in Noble Drew, an East New York housing complex that’s suffered poor management and dangerous living conditions for decades.

“It’s a messy situation, but our chief concern is protecting the units for DHS,” said assistant corporation counsel Ray Mulligan, who plans to file motion papers with Brooklyn Supreme Court Justice Gerard Rosenberglater this week.

Tenants allege Noble Drew’s management evicted residents in order to make space for homeless families that the city pays $90 a night to house. Legal Aid’s suit seeks to block the city from placing homeless families in the complex in the first place, arguing that the units are rent-stabilized and thus reserved for affordable housing. In March, Justice Rosenberg issued a preliminary injunction preventing additional homeless families from moving in until the suit’s resolved.

Reading the near 20-page injunction, Mulligan said Rosenberg misinterpreted the rent-stabilization laws. The city’s motion will argue that the law clearly states that non-profit operators — such as Women in Need, the outfit that services the homeless at Noble Drew — are exempt from the constraints of the rent-stabilization code.

“It’s an inconsistent position,” Mulligan said of Legal Aid’s efforts in the Noble Drew case. “On the one hand, Legal Aid has for years compelled the city to make more space for homeless families; now, they choose to argue that rent-stabilization precludes those goals.”

In prior court appearances, Legal Aid lawyer Mimi Rosenberg has argued that homeless families should be given permanent leases at Noble Drew — a cheaper alternative to the near $3,000 a month the city pays to house the homeless there.

Last year, Brooklyn real estate speculator Zvi Kaufman inked a $7.5 million partnership deal to purchase the property from owner Abdul Rahman Farrahkan, a community leader and failed candidate for state Assembly who assumed control of the property for $10 in 1996 from the Department of Housing and Urban Development. In the past several weeks, Farrahkan has broken his contract with Kaufman and resumed control of the building, a move most tenants abhor. Shootings, poor security and dwindling services are all more common now without Kaufman in charge, many tenants say.

Meanwhile, an increasing number of lawyers continue to wrangle in court. Seated next to nine other attorneys in a hearing last Thursday, Kaufman’s attorney Ken Fisher said, “This is the biggest bowl of spaghetti I’ve ever seen.”