Last Friday morning, the tenants of 9 Laurel St. in Augusta were told their building was unfit for occupancy. They had to be out by that afternoon.

City and state inspectors said they found “significant Life Safety Code deficiencies and some structural problems with exterior porches and stairs.” The building’s owner, Larry Fleury, called the action “heavy-handed,” and argued he could have fixed the problems without displacing the tenants.

According to the city, in the last year seven entire buildings and one floor of an additional building have been declared unfit for occupancy. It is a situation brought on by aging and substandard housing combined with a more stringent fire code. And it raises serious questions about how to maintain suitable, safe, affordable housing, particularly in Maine’s more urban areas.

The most immediate question from Friday’s action is whether the tenants could have been given more time. Uprooting people from their homes is an extreme measure, and more attention should be paid to how it is handled from the tenants’ perspective. One tenant said occupants were given 24 hours’ notice of the inspection, but were not aware they could be forced out the next day.

There should be a better way to keep tenants informed about any impending problems. The people who live in substandard housing are among the most vulnerable. Dealing with the sudden loss of their home is stressful, unsettling and destabilizing.

Fortunately, all of the tenants found a place to stay, many in other units owned by Fleury. If a tenant had been unsuccessful in finding a place to go, the city would have stepped in and helped.

At the same time, solutions are needed for the bigger-picture problem. Programs that build affordable housing or provide vouchers to properties that meet standards have found some success. But demand outstrips supply, and some of the organizations administering those programs have had trouble correctly conducting inspections.

The fact is, many apartment buildings in Augusta, and the rest of Maine, are older, and some are falling into disrepair. Code enforcement offices are typically understaffed, eliminating a key element in keeping landlords motivated to keep up maintenance. That’s not likely to change as buildings get older and budgets tighter. So conditions grow worse, and residents who are unable to move suffer, as does the neighborhood.

In some cases, the landlords of these troubled buildings complete the necessary improvements. Other times, the building is left empty and uncared for, a target for vandals. A suspicious fire damaged a vacant home in Waterville on Sunday, putting neighbors at risk.

Most everyone can think of a street or neighborhood nearby that has fallen into disrepair, one building at a time. Bringing an area back from that condition seems impossible.

That raises hard questions, with no easy answers: How do we keep buildings from deteriorating? How can public resources be used to encourage private investment, and positive ownership? What role does civic pride play?

How can we solve these problems so that fewer Mainers live in substandard housing?

Editor’s note: A previous version of this editorial misreported the number of buildings.