A SECOND federal appeals court has ruled against President Trump’s travel ban on six majority Muslim countries, in effect taking his prolific statements on the campaign trail literally and seriously to impugn the ban’s ostensible purpose of safeguarding national security. “We cannot shut our eyes to such evidence when it stares us in the face,” wrote the chief justice of the U.S. Court of Appeals for the 4th Circuit, in Richmond, for the court’s majority.

As policy, the court rightly made the point that Mr. Trump’s ban rests on a filigree of dubious assumptions, first and foremost that it would somehow safeguard the nation from terrorist attack. In the past four decades, no Americans have died in a terrorist attack in the United States carried out by immigrants from the six countries covered by Mr. Trump’s revised ban: Syria, Iran, Libya, Somalia, Yemen and Sudan. A Department of Homeland Security report shows that immigrants generally become radicalized many years after arriving in the United States, meaning that enhanced screening for visa applicants and refugees from those countries — the stated objective during the hoped-for ban — is unlikely to reduce the risk to national security.

As jurisprudence, the decision strikes us as iffier. Do Mr. Trump’s often incendiary remarks and tweets as a candidate, and those of his campaign, form a legitimate basis for determining that the ban was motivated mainly by what the court called religious animus? The judges concluded that they do, as a matter of common sense. It’s not difficult to imagine the Supreme Court disagreeing.

Presidents have enjoyed, and deserve, broad leeway when it comes to setting immigration limits, as the court repeatedly acknowledged. The judges cited what they regard as the unique circumstances leading to Mr. Trump’s ban as justification for intervening to halt what looked to many Americans like an insult to the First Amendment’s establishment clause, prohibiting religious favoritism. When Mr. Trump, on the stump, called for a “total and complete shutdown of Muslims coming to the United States,” his intent seemed clear enough.

But Judge Paul V. Niemeyer, writing for the three Republican appointees who dissented from the opinion of the court’s 10-member majority of Democratic appointees, made the hardly radical observation that what’s said on the campaign trail may not be incontrovertible proof of a candidate’s real intent, let alone that of an administration not yet formed. Campaign statements, Mr. Niemeyer wrote, “are explained, modified, retracted and amplified as they are repeated and as new circumstances and arguments arise. And they are often ambiguous.”

Much as we find Mr. Trump’s travel ban offensive, imprudent and unwise; much as we believe it inflicts real harm not just on America’s foreign policy objectives but also on families, communities and institutions in the United States, it’s fair to wonder whether it really amounts to an attack on Islam and an affront to the Constitution.