Nonetheless, several city officials agreed that Ms. Torres’s three-year odyssey was a particularly galling situation. “The family has spent three Christmases in a shelter, and that is 100 percent unacceptable for anyone, including us in government, to countenance,” said Stephen T. Levin, the councilman who represents the area. Mr. Levin said that he was trying to hammer out a compromise with the landlord, so far with no success.

“What has been done to these tenants is unconscionable,” said Joseph Soldevere, a spokesman for the city’s Department of Buildings. “Unfortunately, what this case represents above all,” said Mr. Soldevere, “is that owners, particularly using the legal process, can draw things out even when the city brings out all the guns we have.”

After the inspector first came to 94 Franklin Avenue, the landlord, the Tiferes Yehuda Family Trust, filed plans to make improvements to the tenants’ building. The proposal lacked several key changes, and the city rejected it. The landlord returned with new plans in 2016, but they too were incomplete, failing to account for emergency exits and missing floor plans. The city also rejected this proposal.

At that point, the Buildings Department issued a criminal court summons against the landlord. The case dragged on for a year, with both sides having to make more than half a dozen court appearances. Finally, last September, the trustees of the Tiferes Yehuda Family Trust, Esther and Joseph Schneebalg, pleaded guilty to failing to maintain a safe building for the tenants and to working without a permit.

The Schneebalgs were each fined $15,000, and the trust was fined an additional $20,000. This was on top of $14,000 in fines levied against the building over the previous months. The trust now has a new trustee, Meir Schwartz. As of late January, none of the $64,000 in fines had been paid, according to the Buildings Department.

Last August, the city had finally approved a plan submitted by the landlord to repair and bring the entire site up to code. This would also make the synagogue legal. The squat, yellow structure, which takes up the space where the backyard had been, is accessible only by entering the front door of 94 Franklin Avenue. The synagogue is being built for some 100 congregants from the neighborhood, who had been searching for several years for a new home, said Meryl L. Wenig, the lawyer representing Mr. Schwartz, of the Tiferes Yehuda trust. Yet at the moment, the building, like Ms. Torres’s apartment building, is not being used. A visit to the site on a recent Friday night, when observant Jews attend Sabbath services, found it padlocked.