Six months before he issued an executive order imposing crippling sanctions on the International Criminal Court, President Trump reversed the military’s demotion of Special Operations Chief Eddie Gallagher. Gallagher’s fellow Navy Seals had accused him of deliberately shooting non-combatants, including women and children, and of stabbing an unarmed, sedated, teenage captive with a hunting knife. Trump complained that Gallagher had been “mistreated,” labeling him a “very tough guy” and “one of our ultimate fighters.” Where Gallagher’s fellow soldiers saw a war criminal, Trump saw a hero. The same day he cleared Gallagher, Trump pardoned two other U.S. servicemen convicted or accused of war crimes.

The executive order relating to the ICC is proof that Trump’s decision to clear accused and convicted war criminals reflected a worldview and not simply a whim. Intended to shield U.S. and allied soldiers who commit war crimes, and couched in the extreme rhetoric about national sovereignty one normally associates with rogue regimes, the order exposes human rights investigators and prosecutors to the kinds of sanctions usually reserved for drug kingpins and terrorists. The order is grotesque, as others have observed. It is also illegal. Thanks to a lawsuit filed by the Open Society Justice Initiative and a group of prominent international lawyers last week, a federal judge will now have the opportunity to say so.

The mechanics of the executive order are straightforward. It gives the Secretaries of State and Treasury authority to freeze the assets of foreign citizens who have materially supported or directly participated in the ICC’s investigations of U.S. personnel or the personnel of certain U.S. allies. It also bars those foreign citizens and their family members from entering the United States. It also bars others—including U.S. citizens and residents—from transacting with, or providing goods or services to, the foreign citizens whose assets the government has frozen.

A threshold problem with the order is that Trump does not actually have the authority to issue it. The president has statutory power to address “national emergencies” that involve “unusual and extraordinary threats” to national security or foreign policy. While the courts have generally left it to the executive branch to give meaning to these phrases, to hold that the ICC’s activities constitute a national emergency would require courts not just to defer to the executive branch but to abdicate their role altogether. The protection of war criminals is decidedly not a national imperative, and it would be remarkable and indeed unprecedented for an American court to give credence to the notion that it is.

The order’s visa restrictions raise more specific concerns. The courts have repeatedly recognized that U.S. citizens and residents have a First Amendment right to meet with and hear from foreign citizens, and they have required the government to justify visa denials that directly interfere with this right. While the president has authority to suspend the entry of foreign citizens if he concludes that their entry would be detrimental to U.S. interests, his decision must be backed by reasons that are at least “facially legitimate” and “bona fide.” Such reasons are entirely missing here. While Trump’s order states that the ICC’s investigations put national security at risk, it does not identify any harm that would result from the entry of ICC personnel into the United States. To the contrary, the order makes clear that the visa restrictions are retaliatory and performative, intended to “impose tangible and significant consequences” on those responsible for the ICC’s “transgressions” and to “demonstrate the resolve of the United States.”

But it is perhaps the order’s prohibition against providing support to ICC investigators that raises the most significant constitutional concerns. This prohibition, which applies not just to foreign citizens but to U.S. citizens and residents as well, bars essentially any form of support to those whom the Secretary of State has designated under the order. It precludes American lawyers and human rights advocates from advising the ICC, from supplying ICC personnel with legal and factual research, and from filing amicus briefs in support of ICC prosecutors. All of this activity is plainly protected by the First Amendment.

The theory underlying the order seems to be that activity that would otherwise be protected by the First Amendment loses its protection if its aim or result is to support ICC personnel whom the Secretary of State has designated for sanctions. But this theory is wrong. A decade ago, in a case called Holder v. Humanitarian Law Project, the Supreme Court held that the First Amendment did not foreclose Congress from prohibiting the provision of material support to designated organizations. But crucial to the Court’s reasoning in that case was that the organizations in question were engaged in terrorism. The Court reasoned that any form of support to such organizations would free up resources that could be used for politically motivated violence against civilians. It hardly needs to be said that this reasoning has no application here. The ICC is not a terrorist organization, even if Trump’s order would treat it as one.

The lawyers and scholars challenging the executive order are engaged in vital work that serves this country’s interests and honors its ideals. There is no justification for the president’s effort to interfere with it. Indeed, his order will protect those who commit the most heinous crimes, deny justice to victims, demoralize U.S. military personnel who serve honorably, and further erode the United States’ influence in the world. The order is shameful and illegal, and the court should invalidate it.