The Los Angeles City Council unanimously approved an ordinance regulating Airbnb and other home-sharing platforms on Tuesday. Before now, there were no rules on the books regulating short-term rentals.

The ordinance, which has been under debate for more than three years, allows residents to rent out their homes for short stays of up to 120 days each year. It also allows hosts to petition for more than the 120 days by meeting certain criteria, including that the property has not been the subject of repeated nuisance violations.

Units that fall under the Rent Stabilization Ordinance will not be allowed to be rented. Under the ordinance, only primary residences, which is defined as a home where the host lives at least six months out of the year, can be rented. 

According to a Department of City Planning report, about 456,000 nights were booked on Airbnb alone in 2016, and an estimated 550,000 nights were booked by all home-sharing companies in 2017. 

Councilman Mike Bonin said the measure is "far from perfect," but it is "as close as we can get" to striking the proper balance between all the competing interests. He added that the ordinance will be reevaluated six months to a year after being implemented. 

The ordinance is an effort to create a policy that pleases both short-term rental hosts, who say their livelihood depends on the practice, and opponents who say it is contributing to the city's housing shortage and affecting quality-of-life issues in some neighborhoods.

Councilman David Ryu said the ordinance is, "Not a perfect solution, but is the right step to make." 

The ordinance still needs to be signed by Mayor Eric Garcetti in order to become official. If signed by the mayor, it would take effect on July 1. 

City News Service contributed to this report.