The Burbank City Council unanimously approved a temporary ordinance tightening restrictions on single-family home construction Tuesday after a contentious public hearing that stretched past midnight.

The law, which takes effect immediately and could last two years, was a response to what many long-time residents call an “out of control” trend toward tearing down the small, ranch-style homes that characterize the city and replacing them with two-story “McMansions” that cover entire lots. The city has hired a consulting firm to help it draft new residential building codes, but that effort is expected to take more than year to complete, so the law passed Tuesday is considered a stop-gap measure.

The new law closes loopholes in height restrictions and second-story setback rules to make it more difficult for large, boxy homes to be approved. The ordinance also limits the amount of area a house can occupy on its lot and it includes in the total house area any garage space built over 400 square feet.

A total of 38 residents addressed the council, with speakers about evenly split for and against the ordinance. Although some individual real estate agents supported the law, the Burbank Association of Realtors submitted a letter opposing the tougher restrictions. The group’s president, Alisa Cunningham, told the councilmembers Tuesday night that the new law would not be necessary if existing building codes were more strictly enforced.

“We’re an organization that defends private property rights,” she said at the meeting.

But other residents, who have been pushing for anti-mansionization laws for two years, applauded the council’s action. Jim Casey, who heads up a grassroots group called Preserve Burbank said the city has been a “wild West” for out-of-control building.

“This is way overdue,” he said of the law.

A decade ago, the city enacted similar restrictions on residential construction. But in recent years, rising land values and low interest rates have provided powerful motivation for developers and homeowners to find and exploit loopholes in that earlier law that allow for much larger structures than were intended, a city staff report said. The result has been a large increase in what councilmembers called “big box” homes, many of them Mediterranean-style, that loom over neighboring properties, cutting off views and sunlight, the report said.

At the meeting, speakers who have remodels and new construction in the works expressed fears that the timing of the new law will force them to abandon or severely restrict the “dream homes” they have already spent considerable time and money drawing up.

Councilmembers were concerned about those individuals and put in place language that allowed projects already in the pipeline to go forward, with an appeals process available for those who were close to applying for building permits when a March 10 deadline set earlier last month went into effect. City Manager Mark Scott said there had been a flood of new applications late last month week as people rushed to get their permits filed before the council meeting.