SAN DIEGO — Don’t get it twisted, Cruz haters. The Texas senator is a straight-up hero.

When Ted Cruz accepted the invitation to speak at the Republican National Convention and then refused to endorse Donald Trump — only going so far as to urge delegates to “vote your conscience” — members of the Trump family and many pundits accused Cruz of putting himself before the party.

Baloney. What the senator really did was inject decency, standards and integrity into a GOP nominating process that has abandoned all three in the rush to provide a united front against presumptive Democratic nominee Hillary Clinton.

Also, this wasn’t Trump’s convention. It belonged to the Republican Party, and that’s whom Cruz was addressing.

So what if Cruz isn’t falling in line like former Texas Gov. Rick Perry, who not long ago called Trump a “cancer” on the GOP but now supports Trump. Or like House Speaker Paul Ryan, who said Trump’s accusation that a U.S.-born Latino judge couldn’t be impartial because of his ethnicity was the “textbook definition” of racism but now supports Trump. Or like New Jersey Gov. Chris Christie, who described Trump’s plan to ban Muslims as “the kind of thing that people say when they have no experience and don’t know what they’re talking about” and now waits on Trump like a butler. Or like Indiana Gov. Mike Pence, who in May said he didn’t intend to vote for Trump in the Indiana primary but now calls him a “good man” and serves as his running mate.

That’s not how Cruz rolls. As the senator told angry members of the Texas delegation the day after the speech, he is not a “servile puppy dog” that is eager to please.

Good. We already have enough people like that in politics.

For Cruz, the decision not to endorse was personal. The scorched-earth tone of the final days of the primary campaign — when Trump and his loyalists attacked Cruz’s wife, Heidi, on her looks and implied that Cruz’s father, Rafael, was involved in the plot to assassinate President John F. Kennedy — nullified his pledge to support the party nominee, no matter who it was.

“I’m not in the habit of supporting people who attack my wife and attack my father,” Cruz told the delegation Thursday.

Political observers say the senator destroyed his chances of being the nominee in 2020 and that he may have put his current job in jeopardy if Texas Republicans run someone against him in two years.

More baloney. By adhering to his principles and refusing to fall in line behind Trump, Cruz is now the new national leader of a constituency that was crying out for someone to carry the mantle: “Real Republicans Who Are ‘Never Trump.'”

Besides, it was goofy of New York Republican Rep. Peter King — who has never liked Cruz and criticized him often — to accuse him of being “not a true Republican and not a true conservative.”

Hey, congressman, have you met your party’s nominee? Donald Trump was a Democrat most of his life. He got into this race shortly after a private phone conversation with Bill Clinton, fueling speculation in some quarters that his real goal was to destroy the GOP from within. And Trump’s positions on trade, abortion, gay marriage and the Iraq War can hardly be called “conservative” — unless we’re talking about a Manhattan conservative, the kind of person who, anywhere else in America, would be a liberal.

So what if some in the media or the GOP don’t like Cruz? Similar to a certain Republican nominee, Cruz couldn’t care less. Trump supporters who think this sort of attitude is a positive for their guy now believe it’s a negative for anyone else.

I’ve known Cruz for a dozen years, and, while we disagree on some issues, I’m immensely proud of what he did.

According to media reports, Team Trump — having read a copy of Cruz’s speech beforehand — knew that the renegade was not going to endorse the man who beat him for the nomination. And while they let him speak anyway, they reportedly made it clear that he would be booed by delegates.

I guess they hoped the mere thought of such a spectacle would scare Cruz and get him back in line. They were wrong. It took courage and character for Cruz to stand his ground, and he has an ample supply of both.

Overall, it was a great moment for the Lone Star senator. This is one Texan you don’t mess with.

Ruben Navarrette is a syndicated columnist.