What’s happening in Hong Kong right now reminds us that Americans have never been ideologues. In foreign policy, we are happy to live with a messiness in which idealism mingles with self-interest. We need a touch of idealism in ­response to the Beijing regime’s crackdown against dissent in Hong Kong.

President Trump is about the last person you would call idealistic in his foreign policies. He has tweeted about his great friend Kim Jong Un, and his administration ignored a good deal of Saudi nastiness because the Saudis are on our side in dealing with Iran. He has no time for florid Wilsonian rhetoric.

But even Trump understands that foreign policy realism can’t push our country’s values entirely off the table.

The president wants a trade reset with China, and he has signaled that he has tied the negotiations to what is happening in Hong Kong. “Of course, China wants to make a deal,” he said. “Let them work humanely with Hong Kong first!” He also urged Chinese supreme leader Xi Jinping to meet with the protesters to seek an “enlightened” solution to the “Hong Kong problem.”

That’s a good start.

People in Hong Kong are protesting China’s creeping control over the territory’s internal affairs. It’s an oil-and-water problem. Hong Kong is among the freest places in the world. Mainland China is one of the least free.

Until 1997, Hong Kong was a British colony and a good advertisement for ordered liberty. But that year Britain’s lease ran out, and the territory reverted to Chinese rule.

It wasn’t an unconditional handover, however. China agreed with Britain that Hong Kong would remain a self-governing bastion for 50 years, until 2047. China’s leaders agreed to this because they understood that their country profits from the Hong Kong economy.

At the same time, nothing is more central to Chinese thinking than the “One China” policy, uniting all Chinese territories under a single rule. So Beijing won’t tolerate anything that smacks of Hong Kong separatism, and that includes the pro-democracy movement.

China says this is an internal Chinese problem, and the West shouldn’t interfere. But if the Chinese breach the accord ­before 2047, we don’t have to ­ignore this in our trade and other dealings with them, especially not when the pro-democracy protesters are waving the American flag.

Forget some athletes who take a knee at the sight of the Stars and Stripes during the national anthem. They are part of the craziness of our politics and media culture. What matters is what the flag represents to the people in Hong Kong. Or what the Statue of Liberty meant to the people at Tiananmen Square 30 years ago.

That’s what we mean to the world, and too bad for the folks who take a knee if they forgot it.

Idealism can’t be the only driver in our foreign policy, of course. Fifteen years back we were told that freedom is written on everyone’s heart. It’s not, and the failure of George W. Bush’s wars should have inoculated us against buying into such liberal fantasies.

But there is a danger of overcompensating against George Bush’s idealism.

The rancor of our politics has turned Americans into binary thinkers. It has to be all one way or all another way. Either you are an absolute economic nationalist, or else you don’t care about Americans at all. But life is messier than that, and you don’t have to drive into the tree on the left to avoid the car accident on the right.

Nobody thinks we should trench on China’s sovereignty over Hong Kong. But that’s not the only option. We can also signal that we expect them to honor the 1997 accord. We don’t have to spell out the consequences, just let them know that there would be some. That’s what Trump telegraphed with his tweets. But he can, and should, do more.

If we don’t — and before Thursday, Trump had been waffling on the Hong Kong protests — it would mean ignoring our country’s tradition of freedom and those American flags. We would be signaling weakness, not strength. We would be inviting Communist China’s contempt.

Sometimes idealism is the higher form of realism.

F.H. Buckley teaches at Scalia Law School. His next book is “American Secession: The Looming Threat of a National Breakup” (Encounter, 2020).