President Trump has warned China that it must respond “humanely” to the protests in Hong Kong if it wants a trade deal, for the first time suggesting that the United States would impose costs on Beijing if it launched a Tiananmen Square-style crackdown on the city. It’s about time. China is in a much weaker position in Hong Kong than many realize. It claims to be showing “restraint,” but the fact is if China could easily crush the protesters, at a cost acceptable to Beijing, it would have done so by now.

The situation China faces in Hong Kong is very different from the one in Tiananmen Square three decades ago. At Tiananmen, the protesters were gathered in a large public square like sitting ducks where they could be easily mowed down. In Hong Kong, protest tactics have been adopted specifically to avoid another Tiananmen. The protesters are “like water” flowing through a huge and crowded city. Moreover, the Hong Kong protests are leaderless, which means there is no cadre of organizers who can be rounded up to break up the movement.

In Tiananmen, the clearing operation was conducted in the dark of night and out of sight of the media. A Hong Kong intervention would take place in the full glare of the international press corps and under the scrutiny of millions of cellphone cameras.

Finally, a military intervention would mean the end of Hong Kong, and that is something Beijing cannot afford. The mainland economy is slowing and might even be contracting. Trump is hammering China with tariffs. If President Xi Jinping cracks down, he will cause capital and talent to flee the city, which could kill the golden goose.

So, what should Trump do? He should warn Xi that if he launches a crackdown in Hong Kong, then the United States will repeal the Hong Kong Policy Act, under which we treat Hong Kong separately from China and give it better terms. That treatment rests on the idea that Hong Kong is a distinct entity, but if Beijing moves in and occupies the city, ending its autonomy under the “one country, two systems” principle, then the rationale for treating Hong Kong better disappears. (It’s worth noting that nearly 1,400 U.S. businesses operate in Hong Kong.)

Trump should also tell Xi that if he cracks down, the United States will welcome Hongkongers as refugees.

Trump should make clear that the cost of military intervention will be capital flight, brain drain and the end of Hong Kong’s preferential trade status, as well as any hopes of a trade deal. China would face massive tariffs and international sanctions that could send its economy into full contraction.

China does not have the upper hand in this standoff; Trump does. He should use his leverage to save Hong Kong.

Marc Thiessen writes a twice-weekly column for The Post on foreign and domestic policy and contributes to the PostPartisan blog. He is a fellow at the American Enterprise Institute, and the former chief speechwriter for President George W. Bush.