The motorized scooters that have appeared in San Francisco over the last few weeks will need a permit to be parked on a sidewalk, under a law the Board of Supervisors unanimously approved Tuesday.

The ordinance by Supervisor Aaron Peskin allows the San Francisco Municipal Transportation Agency to create rules for the stand-up vehicles.

“I’m quite amazed at the brouhaha,” Peskin said at Tuesday’s board meeting, referring to City Hall’s recent skirmishes with the three scooter rental companies, LimeBike, Bird and Spin. The companies unceremoniously dropped their fleets on city streets last month so that riders could rent them for short trips, using an app.

They quickly became part of the urban fabric as commuters piloted the slender devices along bike lanes and roadways, weaving around pedestrians on sidewalks. Some people praised them as an environmentally conscious alternative to gas-powered cars.

Now Playing:

But others recoiled, saying that the scooters were dangerous, cluttered the sidewalks and littered the landscape, and that the tech companies were unfairly using public roadways to run a business.

Last week, the city’s Department of Public Works impounded dozens of scooters in response to complaints that they were blocking sidewalks and building entrances, creating a hazard for pedestrians, especially for people in wheelchairs.

On Monday, City Attorney Dennis Herrera sent cease-and-desist letters to the companies, calling their scooters a “public nuisance.”

Peskin introduced his ordinance on March 6 after seeing the scooters descend on other cities, such as Santa Monica. In addition to imposing a permit system, it allows the Public Works department to clear out any scooters left on sidewalks without a permit.

Although the board unanimously supported the permit system, one supervisor noted a positive side to the scooter craze.

Supervisor Jeff Sheehy, who was one of five co-sponsors of Peskin’s ordinance, said he’d test-ridden one of the two-wheelers. He saw them as an “interesting solution” to traffic congestion in San Francisco — if the right infrastructure were put in place.

Rachel Swan is a San Francisco Chronicle staff writer. Email: rswan@sfchronicle.com Twitter: @rachelswan