San Francisco and Airbnb reached a deal Monday in a lawsuit stemming from San Francisco's efforts to try to prevent the short-term rental website from including housing units that violate city rules restricting who can list properties and for how long.

Critics complain Airbnb's business model encourages landlords to take already scarce rentals off the market. Supporters say they couldn't live in San Francisco without the extra money made in rentals.

City officials responded by allowing owners and tenants to rent out their places for short periods, but under strict conditions aimed at protecting the city's housing supply. And they required residents to register their units to help officials monitor their compliance.

Monday's settlement came in a lawsuit filed by Airbnb that sought to block a city ordinance that threatened the company with fines up to $1,000 for every booking it completed for a unit not registered with the city.

Under the deal, residents will have to provide their registration number in order to list a rental on the website.

The company will provide a monthly list of all San Francisco listings to the city, so officials can verify that units are registered. Airbnb will deactivate listings that the city says are invalid.

"This settlement protects our neighbourhoods and will help prevent our precious housing stock from being illegally turned into hotels at the expense of evicted or displaced tenants," City Attorney Dennis Herrera said.

Airbnb said in a statement that the agreement "puts in place the systems and tools needed to help ensure our community is able to continue to share their homes."

Airbnb -- the world's largest short-stay online rental company -- is based in San Francisco.

The city requires residents who list units on the site to limit the length of stays to less than 30 nights at a time. Residents can rent out their units when not present there for a maximum of 90 nights in a year.

Additionally, people can only register one unit and must live there for 9 months each year.

The city argued that only 2,100 of the more than 8,000 San Francisco listings on Airbnb were registered, making enforcement of those requirements difficult. It sought to put teeth in the registration requirement by threatening Airbnb with fines and even criminal prosecution for completing transactions with unregistered units.

Airbnb argued the city would force it to screen and remove listings because the company would not want listings for units that could not legally be booked. The company said that role would violate a 1996 federal law that prohibits internet companies from being held responsible for content posted by users.

A federal judge in San Francisco rejected that argument, but said Airbnb might still be able to block the law on the grounds that the city does not have a way for it to quickly determine whether a unit is registered.

U.S. District Judge James Donato in November told the city and Airbnb to work harder to resolve Airbnb's lawsuit.

Chris Lehane, head of global policy and communications for Airbnb, said on a conference call with reporters that the settlement provides a simple registration system while allowing the city to make sure hosts are following the law.

Under the deal, people will be able to register with the city directly through Airbnb.

City officials said it will take four months to build the technology to allow that to happen. Residents currently must submit their registration application in person at a city office.

Existing hosts will be phased in to prevent disruptions, but all of them must be registered by 2018, Herrera said.

Airbnb has agreed to drop its lawsuit if the San Francisco Board of Supervisors endorses the settlement, Herrera's office said.