Stupid but legal. Such is the Trump administration’s travel ban for people from seven Muslim countries. Of course, as with almost everything in American life, what should be a policy or even a moral issue becomes a legal one. The judicial challenge should have been given short shrift, since the presidential grant of authority to exclude the entry of aliens is extremely wide and statutorily clear. The judge who issued the temporary restraining order never even made a case for its illegality.

The 9th Circuit Court of Appeals has indeed ruled against the immigration ban, but even if the ban is ultimately vindicated in the courts (as is likely), that doesn’t change the fact that it makes for lousy policy. It began life as a barstool eruption after the San Bernardino massacre when Donald Trump proposed a total ban on Muslims entering the country “until our country’s representatives can figure out what the hell is going on.”

Rudy Giuliani says he was tasked with cleaning up this idea. Hence the executive order suspending entry of citizens from the seven countries while the vetting process is reviewed and tightened.

The core idea makes sense. These are failed, essentially ungovernable states (except for Iran) where reliable data is hard to find. But the moratorium was unnecessary and damaging. Its only purpose was to fulfill an ill-considered campaign promise.

It caused enormous disruption without making us any safer. What was the emergency that compelled us to turn away people already in the air with already approved visas for entry to the United States?

(Victoria Walker/The Washington Post)

President Trump said he didn’t want to give any warning. Otherwise, he tweeted, “the ‘bad’ would rush into our country. . . . A lot of bad ‘dudes’ out there!”

Rush? Not a single American has ever been killed in a terror attack in this country by a citizen from the notorious seven. The killers have come from countries that are not listed — Egypt, Saudi Arabia, the UAE, Lebanon, Pakistan and Kyrgyzstan (the Tsarnaev brothers). The notion that we had to act immediately because hordes of jihadists in these seven countries were about to board airplanes to blow up Americans is absurd.

Vetting standards could easily have been revised and tightened without the moratorium and its attendant disruptions, stupidities, random cruelties and well-deserved bad press.

The moratorium turned into a distillation of the worst aspects of our current airport-security system, which everyone knows to be 95 percent pantomime. The pat-down of the 80-year-old grandmother does nothing to make us safer. Its purpose is to give the illusion of doing something. Similarly, during the brief Trump moratorium, a cavalcade of innocent and indeed sympathetic characters — graduate students, separated family members, returning doctors and scientists — were denied entry. You saw this and said to yourself: We are protecting ourselves from these ?

If anything, the spectacle served to undermine Trump’s case for extreme vigilance and wariness of foreigners entering the United States. There is already empirical evidence. A Nov. 23 Quinnipiac poll found a six-point majority in favor of “suspending immigration from ‘terror prone’ regions”; a Feb. 7 poll found a six-point majority against . The same poll found a whopping 44-point majority opposed to “suspending all immigration of Syrian refugees to the U.S. indefinitely.”

Then there is the opportunity cost of the whole debacle. It risks alienating the leaders of even nonaffected Muslim countries — the 57-member Organization of Islamic Cooperation expressed “grave concern” — which may deter us from taking far more real and effective anti-terror measures. The administration was intent on declaring the Muslim Brotherhood a terrorist organization, a concrete measure that would hamper the operations of a global Islamist force. In the current atmosphere, however, that declaration is reportedly being delayed and rethought.

Add to that the costs of the ill-prepared, unvetted, sloppy rollout. Consider the discordant, hostile message sent to loyal law-abiding Muslim Americans by the initial denial of entry to green-card holders. And the ripple effect of the initial denial of entry to those Iraqis who risked everything to help us in our war effort. In future conflicts, this will inevitably weigh upon local Muslims deciding whether to join and help our side. Actions have consequences.

In the end, what was meant to be a piece of promise-keeping, tough-on-terror symbolism has become an oxygen-consuming distraction. This is a young administration with a transformative agenda to enact. At a time when it should be pushing and promoting deregulation, tax reform and health-care transformation, it has steered itself into a pointless cul-de-sac — where even winning is losing.

Read more from Charles Krauthammer’s archive, follow him on Twitter or subscribe to his updates on Facebook.