Democrats in California are showing how the party could undermine its own cause in midterm elections in November.

By rebuffing the re-election bid of the state's four-term senator, Dianne Feinstein, over the weekend, the Democratic left wing is exposing its preference for ideological purity over the pragmatism the party would need to turn widespread distaste for President Donald Trump into a historic political victory.

Fewer than 40 percent of delegates to the Democrats' state convention in San Diego voted to endorse Feinstein, while more than half supported her more liberal opponent, state Senate leader Kevin de Leon. That meant that neither candidate received the 60 percent needed for an official endorsement. The two will square off in a June 5 primary, with Feinstein well ahead in opinion polls and fundraising.

The anti-Feinstein activists could have made a strong case for opposing the 84-year-old incumbent to promote generational change. The Democratic Party in Congress has an unusually elderly leadership.

Instead, they framed their opposition as ideological: Feinstein, they said, is too accommodating to her Republican colleagues, unwilling to confront Trump, opposed to a government health care system and 15 years ago voted for the Iraq war.

The left-wing bill of particulars ignored a lot of other things in Feinstein's record. For example, she led a six-year effort to force disclosure of the details of the interrogation techniques and torture used in the battle against al-Qaida, taking on bitter battles against Senate Republicans, the Central Intelligence Agency and the White House under President Barack Obama. She didn't achieve full disclosure but Americans learned a lot about this unsavory period because of her determination and courage.

Some of the left's criticism is reasonable. For example, Feinstein spent a lot of time seeking common ground with Senate Judiciary Committee Chair Charles Grassley, R-Iowa, who seems more intent on protecting Trump than on practical compromise. She did vote for the Iraq war in 2002, but so did a majority of Senate Democrats, including their last three leaders, Tom Daschle, Harry Reid and Chuck Schumer, and two of the last three Democratic presidential nominees, John Kerry and Hillary Clinton (Obama wasn't in the Senate yet).

This was a mistaken vote for what turned out to be a disastrous policy. But to paint Feinstein as a puppet of the national-security establishment, as the left wing does, is to ignore what she achieved in exposing the torture abuses. One of the few Republicans to support her was Arizona Sen. John McCain, who knows a bit about torture, and their battles with CIA Director John Brennan, Republican colleagues and the Obama administration were intense. Because she persevered, it's much clearer how ineffective these methods were and how much money and good will was wasted.

Feinstein for years has been the Senate leader in the fight for gun control, especially for banning the use of most assault weapons. This is a personal issue for her; she became mayor of San Francisco in 1978 when Mayor George Moscone was shot and killed by a political opponent.

And her opposition to single-payer health insurance is consistent with the views of many leading Democrats of good standing in liberal circles, including Obama and House Democratic Leader Nancy Pelosi of California. Yet most of her policy positions are consistent with the liberal Democratic mainstream's.

If similar litmus tests spread to other Democratic primary contests and the left dampens enthusiasm in November for proven winners like Feinstein, that would be a gift to Republicans. The most enthusiastic reception at the California convention went to Rep. Maxine Waters, a divisive figure who has become a favorite right-wing symbol of Democratic extremism for her policy positions and cries to impeach Trump.

That's different from understandable questions about re-electing another elderly candidate in a party that needs compelling fresh faces. But the same left-wing crowd would have cheered for a 76-year-old if his name were Bernie Sanders.