A top D.C. official said yesterday that the city would go to court if necessary to stop a federal agency from yanking subsidies and evicting tenants at complexes that have failed housing inspections.

City Administrator Robert C. Bobb said such action by the U.S. Department of Housing and Urban Development would allow the buildings to be converted to luxury residences and subvert the goal of providing low-income housing.

At least three low-income complexes in a rapidly gentrifying part of Northwest Washington could be cut from the federal Section 8 program and threatened with foreclosure because they have failed at least two annual inspections, HUD officials said.

Hundreds of poor tenants, many elderly, would get vouchers to seek housing elsewhere, officials said. Building owners would be free of their obligation to provide low-cost housing. To avoid foreclosure, they could sell their properties or pay off their mortgages -- scenarios that would open the door to market-rate redevelopment.

Bobb said he asked HUD to reconsider but was turned down. City building inspectors are reexamining the buildings HUD has given failing marks, he said, and officials could seek restraining orders to fight evictions.

"This property is so prime that . . . it's going to become high-rise, expensive condos," Bobb said. "With all due respect to HUD, I just don't understand at this point what the motivation is to throw these people out on the street."

HUD officials said they don't want residents in housing deemed unsafe. Section 8 contracts, an agency spokesman said, guarantee building owners opportunities to avoid foreclosure.

The agency has proposed foreclosing on Kelsey Gardens, a 54-unit complex on Seventh Street NW, just north of the Washington Convention Center in the Shaw neighborhood, where rowhouse shells can go for $400,000 and up, and new condominium projects have been sold out even before they were built.

The agency is poised to do the same at Sursum Corda and Temple Court, adjacent complexes that total 411 residences just off North Capitol Street NW, said a HUD official who oversees the process from the Baltimore field office. She spoke to a reporter only on condition that she not be named, in accordance with HUD regulations.

Both complexes -- just north of the booming downtown housing corridor -- may get a last-minute reprieve, the official said. Sursum Corda, a resident-owned cooperative where a 14-year-old girl was slain last year, has until tomorrow to appeal its latest failed inspection. And Temple Court will be reinspected next month because the most recent inspection was conducted prematurely, she said.

Tenant advocates said it is increasingly hard to find landlords willing to accept rental assistance vouchers offered under Section 8. They said they are concerned about depleting affordable housing in the area.

"We're talking about hundreds of units in a single neighborhood," said Gloria Robinson of Manna CDC, a Shaw-based nonprofit group and advocate for Kelsey Gardens residents.

Sursum Corda and Temple Court residents are working with neighborhood activists and the Washington Interfaith Network. They have met with Bobb and city housing officials and have scheduled a session to protest the changes with HUD officials at 5:30 tonight at St. Aloysius Church, at North Capitol and I streets NW.

"If we get a housing voucher, where are we going to go?" asked Annie Holbrook, president of the cooperative association at Sursum Corda, which relies on the Section 8 program to pay its mortgage.

Diane Hunter, president of the tenants association at Temple Court, said HUD should force property owners to fix up their buildings or find other owners who will, rather than relieve landlords of their affordable housing obligation.

Andrew A. Viola, a vice president at Bush Construction Corp., which owns Temple Court, said the company tries to keep up the property despite frequent vandalism. Viola said Bush is committed to affordable housing but would convert the property to condominiums if its Section 8 status is terminated.

Bobb said Mayor Anthony A. Williams (D) wants to address longstanding problems at Sursum Corda, Temple Court and a neighboring public housing property, Sibley Plaza, by redeveloping them to include both market rate and low-income housing. The city would take advantage of the hot market to increase the number of units to make room for higher-end residences.

He said Williams wants to borrow hundreds of millions of dollars in bonds to pay for the project and repay the debt over time with city affordable housing dollars -- a financing method rejected by the D.C. Council in recent budget deliberations.

Sursum Corda, a low-income complex off North Capitol Street, could get a reprieve from the U.S. Department of Housing and Urban Development. The complex has until tomorrow to appeal its latest failed inspection.