So the nurse is the administrator, and the activities director. The medical technicians serve lunch. The aides double as housekeepers and launderers. And the residents who remain, making their way through empty halls past locked-up rooms in what they say is a building falling increasingly into disarray, wait to see if they will also be forced out.

Image Annemarie Mogil, 92, makes her lunch requests. Credit... Hiroko Masuike/The New York Times

“They played games,” said Alice Singer, 90, a retired bacteriologist who is one of a small group of residents suing the operator of the residence over what many see as a campaign to harass the residents out of the building so that it can be turned into luxury condominiums, the latest casualty of Brooklyn’s housing boom. “They wanted us to leave, and that’s all there was to it.”

A judge has repeatedly ordered the building’s owner, Haysha Deitsch, to restore services while the court weighs whether the State Health Department should have let him begin closing it earlier this year. Mr. Deitsch’s company initially gave residents 90 days to move out, prompting many to leave, but the judge ordered last week that eviction proceedings not be started against those who remained.

When he announced the closing in March, Mr. Deitsch blamed mounting financial losses and a soaring tax bill. But then it emerged that he had sold the building in January to an investment firm, Sugar Hill Capital Partners, for $76.5 million. Sugar Hill sued Mr. Deitsch in August, claiming he had failed to meet the conditions of the sale, which included closing the residence. (The deal included a bonus for Mr. Deitsch if he reduced the number of residents to fewer than three within 16 months after the sale closed, according to court filings in the litigation between him and Sugar Hill.)

The residence is trying to surrender its operating certificate “not because of any financial difficulty in operating the facility, but in order to sell the building to an entity that will convert the building to unregulated housing,” wrote the judge, Justice Wayne P. Saitta of State Supreme Court in Brooklyn, in his ruling last week.