THE cliché of luxury penthouses and Gucci stores cheek-by-jowl with filth and poverty is usually reserved for poor-world entrepôts. But the contrasts in San Francisco—the richest city in America by median household income—could in places rival those in Mumbai. Fresh human excrement and discarded needles lie scattered on the streets of the Tenderloin district just a few blocks from the five-star hotels of Union Square in the city’s downtown. Complaints about shit in the street more than tripled, to 21,000, in the eight years to 2017; for needles the number shot up from 290 in 2009 to nearly 6,400 in 2017. The city’s sanitation department spends half its $60m street-cleaning budget on the stuff. Meanwhile, a typical one-bedroom flat now rents for $3,440 per month, according to Zumper, a rental website—the highest figure in the country. The median house price has nearly doubled in the past five years, to $1.6m.

On June 5th San Franciscans will elect a new mayor. The special election, called after the previous mayor died suddenly of a heart attack, has been defined by the twin topics of housing and homelessness. There are three leading candidates, all liberal: London Breed, Jane Kim and Mark Leno. Each would represent a first as mayor of the city. Ms Breed would be the first black woman, Ms Kim the first Asian woman and Mr Leno the first openly gay man. On housing, though, they take different stances. Whereas Ms Breed has pledged to liberalise the city’s housing regulations to rein in the city’s runaway rents, Ms Kim and Mr Leno have taken a cooler approach.

San Francisco is an extreme example of a national trend among big cities: demand for housing far exceeds supply. Since 2010 new jobs in San Francisco have outpaced additional homes by a ratio of eight to one. Critics tend to blame the most visible side of the equation. Anti-gentrification activists have shot at tech-workers’ commuter buses with pellet guns and vandalised the whizzy electric scooters dotting the pavements. But they pay too little attention to the supply side.

The city’s zoning laws are among the most restrictive in the country. They limit the height and density of new buildings and give local residents, often property owners, the ability to severely delay new development. Most of the city’s land area, particularly the posh western bits, is zoned for single-family homes, which now comprise one-third of its housing stock. Almost all the city’s land faces height limits of 40 feet, or about three storeys. The result is a city where rents are sky-high but buildings are not.

The planning process is a bureaucratic quagmire, made worse by NIMBYism and nonsensical neighbour complaints. A 75-unit complex in the Mission district is being held up by an investigation into whether a laundromat qualifies as a historic site. A 150-unit housing project for pensioners, with 20% of flats set aside for the formerly homeless, was nixed after fierce opposition from locals in the prosperous Forest Hill neighbourhood. City councillors use the process as a negotiating tactic to extract fees and taxes from developers. “There’s regulatory capture and artificial scarcity all across the city,” says Laura Clark of YIMBY Action, a local pressure group.

Flood the zone

Changing the system will be difficult. One bill, called SB 827, put forward in the California state legislature this year, died in committee but may be resuscitated. It proposed overriding local zoning restrictions to spur building in areas near public transport. It would have applied to 96% of San Francisco’s plots of land. But the proposal has had a frosty reception from the mayoral candidates. Mr Leno does not believe that “one-size-fits-all state zoning laws” work. Ms Kim sees SB 827 as too generous to developers: “If I’m going to give you ten additional storeys, I’m going to want you to increase your middle-income housing programme,” she says.

Ms Breed, who supported SB 827, is more realistic. “At the end of the day people lose,” she says. “Housing still isn’t built because of these obstructionists.” She would also like to cut bureaucratic delays and slash building times in half. Though she grew up in public housing and until recently lived with a flatmate, Ms Breed has come under attack for being too cosy with developers (or “real-estate speculators” as leftish critics vilify them)—and with the right. When her campaign wooed Republican voters by circulating an endorsement letter from George Shultz, a former secretary of state under Ronald Reagan, many left-wing activists were outraged.

A further constraint on the city’s housing supply is its wide-ranging rent-control scheme, which now applies to around 45% of units. All three leading candidates, including Ms Breed, would like to see it expanded. “Housing is one of those goods that the market can never take care of all people for,” says Ms Kim. Nor is housing affordability “merely a market problem that can be solved by the market”, according to Mr Leno. For residents, it is an appealing solution in a city increasingly populated by the obscenely well-paid. Yet rent-control policies make housing shortages worse. A recent paper by Rebecca Diamond, Tim McQuade and Frank Qian, all of Stanford University, found that such policies had driven up rents by 5% citywide because they restricted supply. Awkwardly, other west-coast cities, like Portland, Oregon, are increasingly considering San Francisco’s rental restrictions as a solution to their own woes.

The candidates must also deal with homelessness. Here they have fewer differences than over housing, although Mr Leno has pledged, rather unrealistically, to eliminate street sleeping by 2020. At the last count, in 2017, San Francisco had a homeless population of 7,500, 58% of whom live on the streets or without formal shelter. Despite the uptick in complaints about street cleanliness (see map), those numbers have barely budged since 2013. That compares favourably with the rest of the state, which saw a 14% increase in homelessness from 2016 to 2017. In Oakland, across the bay from downtown San Francisco, the homeless population surged 25% from 2015 to 2017. In one large homeless encampment in Oakland, hidden under the interstate, makeshift tents cluster together beneath flimsily tied tarps. San Francisco, on the other hand, has nearly eliminated such encampments in recent years.