Bernie Sanders is playing a dangerous game. If he and his campaign continue their scorched-earth attacks against the Democratic Party, they will succeed in only one thing: electing Donald Trump as president.

I say this as someone who shares much of Sanders’s political philosophy; I, too, for example, see health care as a basic right. He has run a remarkable and historically significant campaign, pulling the party to the left and pumping it full of new progressive vigor. His crowds are almost as big as Trump’s and perhaps even more enthusiastic. Most important, he has brought legions of young people into the political process.

But he hasn’t won the nomination.

Hillary Clinton has an insurmountable lead in pledged delegates, earned by her performance in primaries and caucuses. In the aggregate, she leads Sanders by about 3 million votes. The will of the party is clear: More Democrats prefer Clinton over Sanders as their nominee.

Instead of accepting this obvious fact, the Sanders campaign is behaving like a 2-year-old who can’t have ice cream for breakfast. All along, Sanders and his aides have claimed that the party establishment was unfairly tipping the scales in favor of Clinton. Now the Sanders people have gone further and are deliberately stoking anger and a sense of grievance — less against Clinton than the party itself. This is reckless in the extreme, and it could put Trump in the White House.

After a narrow victory in Oregon May17, Democratic presidential candidate Bernie Sanders is vowing not to give up in the fight against rival Hillary Clinton for his party's nomination. (Reuters)

I do not believe I am being alarmist. The conventional wisdom holds that Trump’s astronomically high disapproval numbers should make him unelectable. His misogyny turns off women; his bigoted immigration stance repels Hispanics; his shoot-from-the-lip temperament disturbs voters concerned about national security. On paper, this should be a cakewalk for any Democrat with a pulse.

In this election cycle, however, the conventional wisdom has been consistently wrong. It didn’t see the Trump phenomenon coming. It thought Jeb Bush would be the GOP nominee, or maybe Marco Rubio. It viewed Sanders as nothing more than a fringe candidate. Most of the Nostradamuses of political commentary, let’s face it, are on a serious losing streak.

The RealClearPolitics poll average has Clinton narrowly leading Trump, 45.8 percent to 42.5 percent; a Fox News poll released Wednesday actually showed Trump with a slight lead. At this point in a presidential year, general-election polls usually don’t mean much. And yes, Democrats have a built-in Electoral College advantage. But it would be foolish not to plan for a tight contest in which every single vote counts.

Clinton is a better campaigner than many people give her credit for, but she has two major vulnerabilities that Trump will seek to exploit: Many people do not find her trustworthy, and she has been a leading member of the political establishment for decades.

Trump’s central flaw is much more serious — he is completely unfit for the job of president and could do great damage to the nation both domestically and internationally. But clearly many Americans are in an anti-establishment mood. The question is whether they are so disgusted with traditional politics and politicians that they will cross their fingers and take a flier on Trump.

I hope not. But the Democratic nominee will be all that stands between Trump and the White House. It is possible to believe Clinton would be far from an ideal president and also believe she must be elected because Trump would be an unthinkable disaster.

Given this context, Sanders and his campaign are being shamefully irresponsible. Rather than accept defeat, they claim loudly that the party’s nominating process was rigged against them. They display a degree of entitlement that they have not earned.

1 of 42 Full Screen Autoplay Close Skip Ad × Highlights from Bernie Sanders’s campaign, in pictures View Photos The senator from Vermont is Hillary Clinton’s rival in the contest for the Democratic presidential nomination. Caption The senator from Vermont is Hillary Clinton’s rival in the contest for the Democratic presidential nomination. June 14, 2016 Bernie Sanders arrives at the Capital Hilton to meet with Hillary Clinton in D.C. Matt McClain/The Washington Post Buy Photo Wait 1 second to continue.

They rail against “unfair” and “undemocratic” party processes — unless they work in Sanders’s favor. So party conventions — such as the one last weekend in Nevada, at which Sanders tried and failed to win a couple of extra delegates through parliamentary maneuvering — are bad. But holding caucuses, which have limited participation, instead of primaries is good, because Sanders did very well in caucus states.

Sanders has every right to continue his campaign until the nominee is officially chosen at the convention in Philadelphia. But if he means it when he says he will do everything in his power to keep Trump from being elected, he has to do more than just modulate his rhetoric against Clinton. He and his campaign must stop attacking the Democratic Party in a way that might discourage voters in the fall.

I mean right now. This is serious.

Read more from Eugene Robinson’s archive, follow him on Twitter or subscribe to his updates on Facebook. You can also join him Tuesdays at 1 p.m. for a live Q&A.