One of Donald Trump‘s first moves as president was, at the behest of then chief strategist Steve Bannon, to sign a hasty executive order banning travel into the U.S. by citizens from seven Muslim-majority countries. The ban was quickly shut down by an appellate court, with prosecutors arguing that the president‘s tweets were proof positive that the order was not in the name of national security, and instead constituted an unconstitutional religious test. But the lesson of the travel ban was lost on the president, who on Wednesday night fired off yet another tweet that could legally undermine his own agenda:

Earlier that day, Trump had expressed similar feelings regarding the terrorist attack in New York that left eight dead, telling the press that he would move immediately to end the Diversity Visa Lottery Program that allowed Uzbek suspect Sayfullo Saipov to enter the country, which he called a “Chuck Schumer beauty.” He also said he would consider sending Saipov to Guantanamo Bay, where U.S. law would not apply. “We need quick justice and we need strong justice, much quicker and much stronger than we have right now,” Trump said. “Because what we have right now is a joke and it’s a laughingstock.”

Not only was the president‘s attempt to pin the program on Schumer flawed (while Schumer initially supported the program, he tried to repeal it in 2013 as part of the Gang of Eight’s immigration-reform push), the more glaring issue was Trump‘s blatant disregard for legal precedent—as The New York Times notes, senior public officials are usually cautioned to refrain from commenting on ongoing legal cases. If they do, they risk giving defense attorneys grounds to argue that their clients cannot possibly get a fair trial, necessitating that the case be thrown out.

At this point, Trump sending out a tweet that chips away at his agenda is almost predictable. Not only did he sabotage the travel ban, but a federal judge also ruled to block his ban of transgender troops because the president‘s tweet announcing his decision upended a Pentagon study examining the effects of integrating trans service members. Similar comments from Trump prodded another judge to consider handing a more lenient sentence to Army deserter Bowe Bergdahl, who had been court-martialed and found guilty of deserting his post, but who had also been attacked by Trump throughout his campaign. According to the Times, the judge held that Trump’s comments had undermined the public’s trust in the military justice system, which goes to great pains to ensure that it does appear to be under the direct influence of the president.

It may be too late for Trump to take back his call for the “DEATH PENALTY,” but someone from Trump’s legal team may have filled him in on the thorny issues surrounding sending Saipov to Guantanamo: