Nancy Pelosi won more than 85 percent of the vote in her district on Tuesday. Donald Trump received less than 10 percent of San Francisco’s ballots in 2016.

In hailing from a city that bans plastic straws, freebie Happy Meal toys, and the sale of fur coats, Pelosi represents a parochial cosmopolitanism that does not translate well to other districts. Whereas Speakers Paul Ryan and John Boehner answered to constituents from Middle America as they operated as national figures, Nancy Pelosi faces, again, a unique challenge.

The incoming Speaker of the House speaks for, well, the House of Representatives, but she represents a geographically tiny district—the nation’s smallest outside of Manhattan—that ranks as one of the most politically homogenous in the nation. Nancy Pelosi can represent her constituents or speak for her colleagues. She cannot do both. This poses problems for the sustainability of the Democratic House majority.

The daughter of a Baltimore mayor found a radically different environment after migrating to the West Coast. The San Francisco in which Nancy Pelosi came of age politically also differed greatly from the one that instinctively reelects her every two years. In the 1970s, as I chronicle in Cult City: Jim Jones, Harvey Milk, and 10 Days That Shook San Francisco, Bay Area figures entered politics at their own risk.

The Symbionese Liberation Army (SLA), with its not-so-catchy catchphrase “Death to the fascist insect that preys upon the life of the people,” assassinated Oakland superintendent of schools Marcus Foster on Election Day in 1973. Two months later, the Zebra Killers severely wounded future San Francisco Mayor Art Agnos, then a member of the California Commission on Aging, by shooting him twice in the chest. In 1975, the New World Liberation Front (NWLF) placed a bomb on a windowsill outside of San Francisco supervisor Dianne Feinstein’s daughter’s bedroom. The group shot out windows of her vacation property later that year. Several of Feinstein’s colleagues on the Board of Supervisors received bombs disguised within candy boxes. In the midst of a police and fire strike in late summer, someone placed a bomb on Mayor Joseph Alioto’s front lawn along with the threatening message: “Don’t Threaten Us.” That September, San Francisco witnessed serial joiner Sara Jane Moore attempt to assassinate President Gerald Ford. And forty years ago this month, Supervisor Dan White, a centrist Democrat close to Feinstein, murdered Mayor George Moscone and Supervisor Harvey Milk in an act of sour grapes in response to the mayor’s about-face refusal to re-seat him on the board from which he had recently resigned.

Elected as a member of the Democratic National Committee in 1976 and as the party chair for Northern California the following year, Pelosi owed her standing, and later her seat in Congress, to the Burton political machine. This machine, and the Northern California Democratic Party that Pelosi chaired, worked overtime to legitimize San Francisco’s most diabolical purveyor of political violence in a decade dominated by it.

In 1976, when Jim Jones spun a bizarre conspiracy theory alleging surveillance efforts against Peoples Temple in San Francisco, Congressman Phil Burton made a federal case of it, pressuring the military to investigate. Peoples Temple, dependent on Social Security checks to keep Jonestown running, turned to Burton when federal checks did not make it to Guyana. “The Reverend Jim Jones has taken to heart the Biblical injunction, ‘faith without works is dead,’” Burton proclaimed. “He has translated his commitment to action. He has worked to alert those to the injustices which exist in our society and he has worked tirelessly with those who seek to correct those injustices.” The Burton brothers proved so important to Peoples Temple that the group assigned them code names — “Mr. Baez” for Phil and “Mr. Bellino” for John — for shortwave communications to and from Jonestown.

Burton’s biographer wrote in Rage for Justice that his subject “had kept his distance from Jones.” Others major players in Bay Area politics similarly kept a close distance.

Mayor Moscone appointed Jones to the city’s Housing Commission Authority, where the Peoples Temple madman quickly became chairman. Assemblyman Willie Brown compared Jones to Mahatma Gandhi, Martin Luther King, Angela Davis, and Mao Zedong. When Rosalynn Carter campaigned in San Francisco, Jim Jones introduced her to a local audience. When Jimmy Carter’s running mate, Walter Mondale, landed in San Francisco, he met Jim Jones on the tarmac.

The bad judgment of Northern California’s Democrats spread across the state. Los Angeles Mayor Tom Bradley and California Governor Jerry Brown spoke at Peoples Temple. Brown’s lieutenant governor, Mervyn Dymally, described himself as “tremendously impressed” after accompanying Jones on a visit to Jonestown. When Jones sought to establish his South American commune, Peoples Temple dispatched Congressman George Brown to impress the Guyanese hosts. “Please allow me to introduce to you Rev James W. Jones, a most principled and compassionate man,” Brown wrote Prime Minister Forbes Burnham in 1973.

Less than five years later, when the Temple’s reputation took a hit following credible allegations of violent abuse of members, fake faith healings, and the seizure of income and property from members, Harvey Milk, Willie Brown, and other California politicians wrote Guyanese leaders vouching for Jim Jones.

One California politician bucked the machine. Congressman Leo Ryan, a Democrat from San Mateo County, invited himself to Jonestown after relatives of Temple members petitioned him to rescue their family members from inside the jungle concentration camp. Ryan sought accompaniment from others in the California congressional delegation, including Phil Burton, but he ultimately traveled without any of his colleagues to Guyana. There, the man made powerful by so many California Democrats orchestrated the murder of Leo Ryan and 917 others.

Pelosi’s introduction to Bay Area politics should serve as a cautionary tale against unthinking, lockstep politics. But four decades after Jonestown — and the NWLF, SLA, and much else — San Francisco politics appears as monolithic as ever even if the city appears as a wealthier, more vibrant and culturally-rich community than it did in the 1970s.

For Pelosi to hold on to the speaker’s gavel, she needs to let go of the crank causes and extremist politics that characterizes her adopted hometown. And if her entry into San Francisco politics did not provide this lesson then perhaps her last exit from the speaker’s chair might. After aggressively pursuing a far-left agenda after Barack Obama’s 2008 victory, House Democrats lost 63 seats 2010.

Winning nearly nine out of every ten votes in her recent reelection bid suggests she can afford to sacrifice some local support for the good of the national party. Abolishing Immigration and Customs Enforcement (ICE), holding impeachment hearings, and pushing Medicare for All each strike as precisely the type of ideas enjoying popularity in San Francisco that suggest doom for Democrats elsewhere should the incoming speaker pursue them.

It took eight years, but Nancy Pelosi, older and perhaps wiser, finally got her old job back. Democrats in less safe districts than California 12 need a speaker able to buck the ideologues on the fringes, a politician less like Phil Burton and one more like Leo Ryan.