Boston city councilors voted 11 to 2 Wednesday to approve an ordinance to regulate short-term housing rentals done through platforms like Airbnb. And Mayor Marty Walsh says he looks forward to signing the legislation.

The measure is an amended version of a proposal filed by Walsh last month. It retains a ban on people using websites like Airbnb and HomeAway to rent out units they don't live in. The Walsh administration argues these so-called "investor units" take up valuable housing stock in the city.

In statement Wednesday, Walsh said he hopes the new rules will help strike "a fair balance between preserving housing while still allowing Bostonians to benefit from this new industry. "

The measure does allow people who live in a residence to rent it out on a short-term basis — either a room in the unit, the entire unit or an adjacent unit in a two- or three-family home. All such rentals would have to register with the city and pay varying annual fees.

The most notable change approved by city councilors is an amendment that allows people in two- and three-family homes to rent out their adjacent unit for 365 days a year. Walsh's proposal had capped such rentals at 120 days a year.

Other amendments focus on making data collection on short-term rentals more robust and accessible.

Airbnb said its disappointed with Wednesday's vote and the concerns of its hosts "were not heard."

"The new ordinance unfortunately creates a system that violates the privacy of our hosts, and prevents Boston families from making much-needed extra income in one of the country’s most expensive cities," an Airbnb spokesperson said in a statement.

Those sentiments were echoed by HomeAway. In a statement, a company spokesman said the vote "will have dangerous consequences for Boston’s travel and tourism economy."

Short-term rental operators and residents who use these services have pushed for less restrictive rules. They say short-term rental platforms help people earn much-needed extra income and provide affordable housing options for visitors to the city.

Meanwhile, housing advocates worry about displacement and affordability due to the growing short-term rental industry. The hotel industry has long called for a more even playing field, arguing that short-term rentals operate like hotels and should be regulated. The industry praised Wednesday's vote.

In a statement, Massachusetts Lodging Association president Paul Sacco said the ordinance protects housing in Boston from being snapped up by investors.

"Today’s action preserves the rights of real home-sharers while reining in the bad actors who are contributing to Boston’s skyrocketing housing costs and wreaking havoc on many of our neighborhoods," Sacco said.

Efforts to regulate short-term housing rentals have been under scrutiny in recent years. Last month, city councilors were sharply divided over proposed regulations. At the state level, legislation to regulate short-term rentals has been held up in committee.

The mayor is expected to sign the measure in the coming days.