Gratuitous. Nasty. Petty. Spiteful. Insulting. Just plain rude. When the rhetoric of a major party’s leading presidential candidate falls to this level, we should be scornful.

So, how is it OK when it isn’t just a presidential candidate but a president who does it?

Donald Trump’s policy of demeaning and snarking his political opponents has been a favorite habit of President Obama for the last eight years. Obama is perhaps the first president who believes that leading the country and playing to the beliefs of the extremists in his own party amount to the same thing, and like Trump fans, Obama fans are motivated in large degree by sheer hatred.

They love to hear their idol channel their rage by bashing people they don’t like.

Obama’s latest, silent insult — leaving a spokesman to explain he had better things to do on a Saturday than attend the funeral of a 30-year justice of the Supreme Court — isn’t surprising when you consider the mean-spirited things he says virtually every time he steps in front of a microphone.

This week, Obama spokesman Josh Earnest bashed Sen. Chuck Schumer, who objected to cuts in counterterrorism funding for New York. Earnest said, in essence, why listen to this fool on anything if he opposed the Iran deal, especially since “most Democrats” were in favor?

Police Commissioner Bill Bratton noted, accurately, that this was pure politics — the president was punishing New York to get back at Schumer.

Obama was doing exactly what he accuses Republican members of Congress of doing, calling them “hostage takers . . . [of] the American people.” Except that his rhetoric was about a debate over tax cuts, not Obama’s actual cutting of money needed to keep the nation’s largest city safe.

Meanwhile, when it comes to actual hostage takers, Obama can’t muster much outrage. At last year’s national prayer breakfast, he barely paused to obliquely refer to the Islamists who had just burned alive a Jordanian pilot so he could single out Christianity for bashing: “Lest we get on our high horse and think that this is unique to some other place, remember that during the Crusades and Inquisition, people committed terrible deeds in the name of Christ,” Obama said. “In our home country, slavery and Jim Crow all too often was justified in the name of Christ.”

If you recall Christian principles, as embodied by a minister named Martin Luther King Jr., being a crucial component of civil rights victories, Obama thinks you’re a dope. If you can’t see how 11th-century atrocities more or less cancel out the ones committed the day before yesterday, you’re not the broad historical thinker Obama thinks he is.

Comparing Islamist fanatics to conservative Americans, and implying that he is more comfortable with the former, is a favorite Obama tactic. Dismissing extremists in Iran, Obama said last August, “In fact, it’s those hard-liners who are most comfortable with the status quo. It’s those hard-liners chanting ‘death to America’ who have been most opposed to the deal. They’re making common cause with the Republican caucus.”

Just two days after promising to scale back his attacks on Republicans at the 2013 Jefferson Dinner, Obama told George Stephanopoulos his opponents wanted to “gut Medicare or gut Social Security or gut Medicaid.” At the end of 2012, at a moment when Republicans thought they were on the verge of closing a budget deal with Obama, he instead staged a press conference and said the Republican policy was “we’re just going to try to . . . shove spending cuts at us, that will hurt seniors, or hurt students, or hurt middle-class families.” In 2012, he advised Latino voters to think, “We’re gonna punish our enemies.” In a 2012 chat with Douglas Brinkley for Rolling Stone, he called Mitt Romney a “bulls—-er.”

All of this has come from a president who is forever bewailing the partisan rancor of a country that, he keeps sadly informing us, has let him down by proving unable to discuss its differences in a civil way.

Obama fanboys often claim that their superhero has been subjected to an unprecedented level of attack and can only take so much. Couldn’t Trump justify his insult-based campaign on that basis? George W. Bush certainly took more than his share of abuse, but to fire back would have struck him as ungentlemanly. He ducked the insults as blithely as he ducked that flying shoe in Iraq.

Besides, usually Obama fans are so desperate to come up with an example of “vitriol” directed against their superhero that they wind up quoting the last four words of a 2009 remark by Rush Limbaugh: “Look, what [Obama] is talking about is the absorption of as much of the private sector by the US government as possible, from the banking business, to the mortgage industry, the automobile business, to health care. I do not want the government in charge of all of these things. I don’t want this to work . . . I hope he fails.”

Limbaugh and Obama have more in common than either would like to admit. Except one of them is supposed to represent the entire country. One of them isn’t supposed to sound like talk radio.