The mistrial declared Thursday in the case against Sen. Bob Menendez sends an alarming message: that it’s virtually impossible to send a corrupt politician to jail.

That will just embolden crooked pols — and further erode public confidence in America’s political system.

Think about it: If prosecutors couldn’t win a guilty verdict against the New Jersey senator, just who could they win one against?

Both sides in the Menendez case agreed on the facts: That he took extensive gifts, including free vacations at lavish resorts and $750,000 in campaign donations, from Solomon Melgen, a wealthy eye doctor.

And that he interceded on Melgen’s behalf in a multimillion-dollar Medicare billing dispute, as well as a security contract with the Dominican Republic. He also arranged visas for several of the doctor’s young female “friends.”

But the senator denied there was any quid pro quo, claiming Melgen’s gifts were based on their 25-year friendship and that he only provided the kind of constituent service he’d give to anyone.

Making it even harder to convict was the Supreme Court’s 2016 McDonnell decision, which restricted the range of “official acts” that could be considered corrupt. The ruling overturned the convictions of New York legislative leaders Sheldon Silver and Dean Skelos, despite overwhelming evidence. It also set the bar higher for prosecutors probing Mayor de Blasio’s pay-for-play record.

Menendez’s shenanigans were every bit as sleazy at theirs, if not more so.

Also disturbing: That Senate Democrats refused to agree Menendez should be forced from office — even if he were convicted. And this from a party that’s quick on the draw when Republicans are involved.

Lawmakers need to figure out how to close the loopholes to stem this sprawling spate of corruption. If they don’t, they’ll run the risk of having to watch as America’s political fabric unravels.