The Trump administration’s now infamous executive order imposing a temporary ban on the movement of citizens from several Muslim-majority countries, along with the more durable initial ban on travel to the United States by Syrian citizens, caught thousands of travelers by surprise. Many were holders of U.S. Green Cards, our nation’s next best thing to citizenship that assures the holder’s right to come and go and live in our country. Others caught in the resulting misery had endured extensive vetting by American authorities. Following federal court actions that imposed a stay on the initial order, the White House is now rolling out a second, perhaps more thoughtfully constructed one. But so far, Mr. Trump has offered no apology for the severe hardships generated by his executive order efforts.

The intended goal of the orders was to make America safer by reducing the risk of death by terrorism. Yet sometimes, well-intentioned efforts to make us safer can actually make us worse off. This point was made memorably years ago in, of all places, the comic pages:

Al Capp, that marvelous 1960s cartoonist, was the creator of Li’l Abner and Daisy Mae and their happy village, Dogpatch. He would occasionally give his loyal readers a delightful break from the usual comic strip. Another Capp character, Fearless Fosdick — a relentless but never successful police detective—would parade across the comic pages in search of his evil foe, Anyface. As his name suggests, Anyface was a master of disguise. He could appear at first as an innocent old woman, but then suddenly become a gasoline pump, if Fosdick appeared to be on his trail. Anyface was a terrorist, and no neighborhood was safe with Anyface around.

In one Fosdick episode, Anyface let it be known that he had poisoned one can of Old Faithful Pork-n-Beans, which happened to be the community’s favorite delicacy. Hardly a meal was enjoyed without a serving of the famous beans. Anyface knew that, of course. Wrestling with the problem and what to do about it, Fosdick’s boss, the police chief, gathered together his inner circle. A bunker mentality prevailed. It was law and order against terrorism. Good against evil. Right against wrong.

After some deliberation, the chief saw the light. It was simple. He instructed his trusty detective Fosdick to make certain no one would die from eating Old Faithful beans. Fosdick took his orders seriously. He immediately went to the bean factory, shut it down, and impounded all the beans in a secure warehouse. He gathered all the beans from grocery stores and wholesalers, smiling all the way. Finally, he had the cases and cans of bean under lock and key.

But then it hit him: What if people in their homes had beans simmering on the stove or in bowls ready to serve? Heaven forbid, what if people in restaurants were ready to lift a fork of beans from their plates? Remembering his charge from the chief—don’t let anyone die from eating poison beans—Fosdick knew what to do.

Rushing from house to house and from café to restaurant, when Fosdick saw someone about to heat up a can of beans, he shot them. If people appeared to be ready to lift a forkful of beans to mouth, they were shot, too.

When the episode ended, no one had died from the terrorist’s poison beans—yet a large number died from Fosdick’s gun. Still, with that terrorist Anyface held at bay, Fosdick smiled.

Our nation is plagued by terrorist threats. Our president is sworn to protect us. In doing so, he may choose different courses of action. In an attempt to save us, he may ban all people coming from places associated with terror. He may even ban people who hold Green Cards, breaking promises made by the people he seeks to protect. Mr. Trump, like Fosdick, may be successful in preventing death in this country from the hands of terrorists.

But depending on how he does this, he can erode, if not destroy the precious ideas that define this nation. As with Fearless Fosdick, some may see their lives ruined by Mr. Trump’s effort to save us from terrorism. Sadly, there is no such thing as free protection from terrorist harm. Knowing that, we should move cautiously when attempting to tighten the screen that protects us from harm.