Foreclosed three-deckers have become prime targets for squatters, vandals and thieves, who sometimes set them on fire to gain access to copper pipes inside the walls. In Worcester, 60 percent of vacant, bank-owned dwellings with multiple code violations, are three-families, as are 21 of the city’s 27 condemned buildings.

In New Bedford, whose poorer neighborhoods brim with three-deckers, Mayor Scott W. Lang has set about demolishing the worst of them, including seven so far this year.

“It’s only a matter of time before it begins to spread like a cancer,” Mr. Lang said.

On some streets in New Bedford, tight rows of triple-deckers are now interrupted here and there by dirt lots, which impart the odd effect of missing teeth.

Patrick Sullivan, the city’s director of housing and community development, said its foreclosed three-deckers were mostly owned by absentee landlords who had scooped them up as investments and then let them decay. In one notorious case, Mr. Sullivan said, a single investor bought hundreds of properties in New Bedford and other Massachusetts cities during the real estate boom, ran up dozens of code violations and fled the country.

Mr. Lang hopes the demolitions make room for small parks, community gardens or parking lots.

“It might make sense to open up a little air, allow some green space, create a little more of a recreational-type pattern,” he said.

Boston, home to roughly 15,000 three-deckers, is taking a different approach. It has not demolished any abandoned three-deckers because city officials want to preserve as many affordable housing units as possible, said Evelyn Friedman, chief and director of the Boston’s Department of Neighborhood Development.

Modern zoning laws, Ms. Friedman said, would never allow three units on such small lots.

“If we have four three-deckers on 12,000 square feet and could only get two on that amount of land now,” Ms. Friedman said, “we are losing six units. So it’s very important to us to sustain them.”