Shortly before a tightly contested election for mayor, a new urban transit fad hit San Francisco.

Three tech companies dropped electric scooters all over the city, calling them a sleek alternative to gas-powered automobiles. The two-wheelers careened down bike lanes and cluttered sidewalks. Complaints flooded in, the city confiscated hundreds of scooters and officials scrambled to figure out how to regulate the newcomers.

“It’s like they’ve declared war,” said Mission resident Chantelle Davis, parking a scooter against a lamppost on Market Street on Thursday evening. Within minutes, someone else picked it up and rode off.

In San Francisco, the war between transit companies and the city is nothing new. For the past decade City Hall has battled bike shares, ride-hail services, tech shuttles, electric skateboards and even delivery robots — all managed by private companies that swooped in before politicians could set rules for them.

Transportation often gets overlooked in city political contests, but it’s become a fault line in the race among the four leading candidates: Supervisors London Breed and Jane Kim, and former Supervisors Mark Leno and Angela Alioto. Whoever wins the mayor’s seat will lead a city that’s constantly reacting to new forms of mobility — with a population that keeps growing, even if the width of the streets stays the same.

“The mayor of San Francisco has a lot of influence over transportation,” said Jason Henderson, a professor at San Francisco State University who specializes in urban transportation and lives in Hayes Valley. He noted that the mayor appoints the entire board of directors of the San Francisco Municipal Transportation Agency.

That board sets the budget and policy agenda, and has the power to make big, transformative decisions — like whether to add late-night bus service, or spend money on fleet repairs, or crisscross the city with new bike lanes.

Yet few city officials invest their political capital to achieve these things.

“Our city needs to increase bicycling and the capacity of Muni,” Henderson said. “We’ve got a climate plan that explicitly says, ‘Get cars out of this city.’ It’s easy to just throw your hands up and do nothing — and that’s when these private companies come in.”

The four candidates all have ideas about how to make San Francisco less car-dependent in the future. And they all seem to agree that traffic congestion, fast-paced innovation and overburdened public transit are the most pressing transportation problems in San Francisco. The question is how much they’re willing to intervene.

Breed urges a cautious approach to regulation.

“I gotta tell you, I like having access to Uber and Lyft, and delivery services like Postmates and Caviar,” Breed said. “But we don’t know how many of these things are operating in the city simultaneously.”

She said the city should gather data on how many ride-hail and delivery vehicles are operating at any one time, and then consider a cap.

Kim represents the downtown district, which seems to suffer the heaviest traffic, owing to explosive job growth and a subset of the population that commutes along Highway 101 to Silicon Valley every day. Last year she traveled to Europe to study congestion pricing models — charging tolls to unclog busy streets and roadways and then spending the money on public transit. Kim said she would support such methods in San Francisco.

Leno favors taxing ride-hail companies such as Uber and Lyft.

Alioto has the most radical idea: Turn a big swath of downtown into a giant, car-free piazza.

“I think the area from Market and Battery streets all the way to Sutter and Mason streets should be car-free,” she said. “I’d stick by that.”

All those proposals would probably cause controversy in a city that’s already deeply divided over how to share street space.

To Susan Shaheen, co-director of the Transportation Sustainability Research Center at UC Berkeley, the divide is generational. Older people who didn’t grow up with smartphones and apps have been slower to adopt Uber, Lyft, bike shares and other app-based services. Younger urbanists are more likely to embrace them.

“When we look at the users, they tend to be Millennials,” Shaheen said of newer transportation options, noting that younger people “are much more comfortable getting in a car with a stranger and using a rating system.”

But transit innovations have also caused an ideological split in San Francisco. While some call them a useful and necessary alternative to cars, others say they are parasites, dumped onto the city by companies that don’t pay to use the public infrastructure.

Leno has scathing words for the new e-scooters.

“They have clearly bought into the philosophy of ‘break things,’ including the law,” he said, referring to Facebook’s famous “Move fast and break things” motto.

Crowded streets aren’t the only bad side effect of San Francisco’s population boom in the past few years. More people means busier streets and a higher number of accidents. Traffic deaths jumped from 24 in 2010 to 30 in 2016. Last year marked the first significant dip, to 20 deaths, which officials attribute to the city’s Vision Zero prevention program started by Kim and other supervisors in 2014.

City officials want to eliminate traffic fatalities altogether using the Vision Zero program, which combines public outreach with engineering: new crosswalk signals, protected bike lanes, training for drivers of large vehicles, and curb extensions to make pedestrians more visible.

That’s a huge deal for groups like the San Francisco Bicycle Coalition, which endorsed both Leno and Kim.

“We want to make sure the next mayor is committed to Vision Zero,” said Brian Wiedenmeier, the coalition’s executive director.

Yet even a seemingly innocuous public safety effort has caused discord in City Hall. The firefighters union — a prominent labor group that endorsed Breed — says that some of the widened curbs and bike lanes impede fire engines and ambulances. Union members want the fire marshal to have discretionary power to either modify or reject these safety improvements.

Kim said no, she wouldn’t allow the Fire Department to override pedestrian safety. Alioto said yes, so long as the firefighters’ concerns “are real.” Breed and Leno played the middle, saying the fire marshal should be allowed to make recommendations, and that everyone should compromise.

In addition to safety concerns, many residents are anxious about the social inequalities of San Francisco’s transportation system.

Devices such as the motorized scooters — which get parked all over the city’s sidewalks — can obstruct people in wheelchairs or with mobility problems. And many of the private services are out of reach for people who don’t have smartphones and credit cards.

All four candidates stressed the importance of giving every San Franciscan access to the roadways. And one way to do that is to pour more money into old-fashioned mass transit.

Breed focused on Muni as a supervisor, carrying legislation to expand and replace Muni’s light-rail fleet, changing the seat configuration to fit more passengers on the N-Judah line and speeding up service along the 5-Fulton bus route. She also added trains to loop from Cole Valley to the Embarcadero during morning commute hours.

“People loved it,” Breed said. “If you make Muni more reliable, people will use it.”

Kim said that if elected mayor, she would add cars to the N-Judah and the J-Church Muni Metro lines, where riders pack shoulder-to-shoulder during rush hour. She also wants to expand ferry service, potentially connecting Fisherman’s Wharf to the San Francisco Shipyard project.

Ferries “may be expensive,” she said, but they’re easier to build than other mass transit systems, because “you don’t have to build a new tunnel or track.”

Leno has designs on a new subway, which he said could replace the proposed Bus Rapid Transit line along Geary Boulevard. He encouraged the city to consider going underground instead of continuing a bus project that interferes with the businesses along Geary.

Alioto called for the most drastic changes. She wants to fire San Francisco Municipal Transportation Agency Director Ed Reiskin and do a top-to-bottom audit of the agency.

“My top transportation priority is to make Muni more efficient — add cars, get them to speed up repairs, and get the buses to the point where they’re really on time,” she said. “Muni needs a lot of tools, and that’s why I’m so upset with Reiskin.”

SFMTA spokesman Paul Rose said the agency works with residents every two years “to identify what is important to them, and make the tough decisions to include what we can.”

This year’s budget includes new Muni light-rail cars, a bus maintenance facility and anticipates the opening of the Central Subway, he said.

But having a more functional Muni system is just one step in the long, tortuous process to get people out of their cars.

There are many projects that may still be decades away, including the downtown extension of Caltrain, a northern extension of the Central Subway to North Beach and perhaps Fisherman’s Wharf, and a second transbay BART tube. All of them will cost billions of dollars.

The candidates have proposed various funding mechanisms. Leno, who spent 14 years in the state Legislature, said he would probably take a “regional approach” to transportation planning, seeking funds from the state and federal governments.

He and Breed have also floated the idea of a city vehicle license fee.

Kim said she would support some kind of local revenue measure, though she was vague on details. She opposed Proposition K, a 2016 sales tax initiative that would have raised funding for public transit — Breed supported it.

Alioto is mostly fixated on cutting waste from the SFMTA’s $1.2 billion annual budget.

While the big mass transit projects plod along, residents brace for more innovations on the sidewalks and streets. The pace of technology is accelerating, and there’s lots of demand for small, light vehicles to move quickly across town.

“Age of convenience, right?” joked Davis, the Mission District resident riding the e-scooter Thursday.

She nodded toward Market Street — the spine of the city’s transportation network — where the downtown stretch is closed off to private cars. It’s now packed with bicycles, electric skateboards, overstuffed streetcars and motorized scooters.

Meanwhile, on all the adjacent streets, traffic still inches along.

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