PORTLAND — The City Council on Monday closed a regulatory loophole that exempted the new owners of the Eastland Park Hotel from an ordinance intended to preserve affordable rental housing.

The previous language left a broad exception to a rule that seeks to preserve affordable housing by charging hefty fees to developers who convert permanent housing into hotel rooms or other nonresidential uses.

Developers who do not replace the housing must pay the city $50,000 per lost unit.

Prior to Monday night’s action, an exemption was provided for “consolidation or elimination of dwelling units within an existing structure.”

But that section was changed so it applied to only instances where the square footage of permanent living space was unchanged. Conversions to hotel and motel rooms may not be exempted.

The loophole went unnoticed by the City Council until the Eastland was bought in Februrary by an Ohio-based investment group, RockBridge Capital.

RockBridge received an exemption for $2.5 million in fees it would have owed for eliminating more than 50 residential rentals the company plans to turn into hotel rooms.

About a dozen residents and housing advocates testified in favor of the fix.

One of those residents was Alyssa Hall, 41, who said she is only a couple of paychecks away from being homeless. Hall lives in one of the 50 apartments that are expected to be replaced in the Eastland renovation project.

“My foot is caught in that loophole,” Hall said. “At some point I will have to leave.”

Parkside resident and former state Rep. Herb Adams recalled the history of the 241-room Eastland, saying the hotel originally boasted more than 140 permanent residences with amenities.

Adams said it is “astonishing” that all of the affordable rental units could be gone within 84 years, or an individual’s lifetime. He called on the city to use it’s power of “moral suasion” to force the new owners to preserve that housing.

“I have seen this council exert that moral suasion innumerable times … where you have done so for Portland business,” Adams said. “Here’s a chance for you to do so for tenants who are in a real situation.”

Councilor John Anton, who last year presided over the wholesale rewriting of the ordinance, said the Housing Committee never intended the ordinance to have such a broad exemption.

Instead, Anton said the committee wanted only to protect property owners who wanted to convert several small rentals into one or more larger units, while maintaining the square footage.

Advocacy groups, including the Portland NAACP, Homeless Voices for Justice, Maine Affordable Housing Coalition, Maine People’s Alliance and the Pine Tree Legal Center, all testified on behalf of the change.

Many of those groups cited a greater need for affordable housing in the city. But Anton said the ordinance is only part of the equation.

“It was never envisioned to be the solution,” he said.

Councilor Kevin Donoghue repeatedly apologized to residents who may be affected by the city’s mistake. Not only are people losing affordable housing, but the city lost revenue that it would have otherwise received, he said.

The $2.5 million payment for rental units that are expected to be lost could have been put toward additional affordable housing projects.

Donoghue said the issue highlights the need for affordable housing at a time when vacancy rates are low and rents are increasing, because people who were previously homeowners were now entering the rental market.

“It does raise this issue at an important time,” he said. “I think we have a lot of work to do in the city in terms of housing policy.”

Councilor Jill Duson, who presided over Monday’s meeting, said she would like city staff to work with the Eastland owners to preserve the existing housing.