On Jan. 27, 2017, Donald Trump issued an executive order prohibiting individuals from seven Muslim-majority countries from entering the United States. In the following days, several federal judges blocked parts of the ban, and one week later, U.S. District Judge James Robart froze the whole thing. Throughout those chaotic early days, civil rights groups alleged that Customs and Border Protection officers charged with enforcing the policy had violated court orders limiting their authority. On Thursday, the Department of Homeland Security’s Office of Inspector General released a lengthy report confirming that CBP did, in fact, break the law in its implementation of Trump’s first travel ban.

CBP ran into legal trouble almost as soon as U.S. District Judge Ann Donnelly barred the government from deporting individuals covered by the executive order. By the time Donnelly issued her ruling in Darweesh v. Trump on Jan. 28 of last year, CBP had detained an Iranian national with a student visa at Los Angeles International Airport for 23 hours. When Donnelly’s decision came down, the student was in the process of being placed on a flight out of the country. She promptly informed a pair of CBP officers that a judge had issued a restraining order blocking the ban. The officers did not halt her deportation or ask a supervisor about the ruling. Instead, they forced her to board the plane. (Several days later, she obtained permission to fly back.)

The OIG report suggests this incident amounted to an honest mistake, but it is nevertheless sharply critical of CBP’s broader interpretation of the Darweesh decision. Donnelly’s ruling stated that the executive order likely violated due process and equal protection and that the government could not “remov[e]” individuals covered by the ban. CBP interpreted this to mean that officers could turn away travelers who arrived by land and sea, asserting that these individuals were refused entry, not technically “removed.” OIG criticized this approach, which barred 30 individuals from entering the country, as “a highly aggressive stance in light of the court’s concerns.”

These actions were arguably legal under an extremely narrow reading of Darweesh. But the next day, Jan. 29, CBP crossed a clear legal line. That morning, U.S. District Judge Allison Burroughs issued a decision in Louhghalam v. Trump barring CBP officers at Boston Logan International Airport from detaining or removing anyone covered by the order. She also explicitly directed CBP to “notify airlines that have flights arriving at Logan Airport” that “individuals on those flights will not be detained or returned based solely on the basis of the Executive Order.”

CBP did the exact opposite of what Burroughs’ ruling required. The OIG investigation found that the agency continued to call airlines and instruct them not to let travelers board planes to the United States if they were covered by the order. It did so despite having full knowledge of Burroughs’ restraining order. Indeed, OIG found that CBP did “everything in its power to block [these] travelers” from boarding flights bound for the United States. Officers threatened airline representatives, asserting that the government would fine them $50,000 and bar their planes from landing if they ignored CBP’s (unlawful) orders.

This flat contradiction of Burroughs’ ruling led to a remarkable standoff in Frankfurt. Lufthansa, a major German airline, was preparing to begin the boarding of a flight to Boston that included multiple passengers covered by the ban. A CBP officer stationed at the airport personally delivered an instruction to the Lufthansa flight manager at the departing gate forbidding these passengers from boarding. The airline consulted its legal department and concluded, correctly, that CBP was violating a court order. It therefore rejected CBP’s instruction and permitted the passengers to board.

The OIG report states that “CBP was not pleased with Lufthansa’s actions.” The next few sentences of the report were redacted by the Department of Homeland Security, so it’s unclear exactly what happened next. But in the end, Lufthansa secured entry into the United States for a total of 20 people across multiple flights—people who would’ve otherwise been stranded in Frankfurt.

Two days later, on the evening of Jan. 31, U.S. District Judge André Birotte issued a decision in Mohammed v. United States. Thirty named plaintiffs had filed a lawsuit to halt the executive order, and Birotte ruled in their favor, barring CBP from “enforcing” the order by “removing, detaining, or blocking the entry” of anyone it covered. Birotte’s restraining order clearly applied to all travelers affected by the ban around the world, prohibiting officers in other countries from keeping passengers off U.S.-bound flights. Yet CBP adopted the (legally indefensible) position that the ruling somehow applied exclusively to the named plaintiffs in Mohammed.

OIG disparages this interpretation as a “logical inconsistency” designed to “resist judicial review of CBP’s international operations.” Its report accuses CBP of engaging in “strategic maneuvering” to continue enforcing the ban in contravention of court orders. OIG declares it is “troubled” by the government’s refusal to admit wrongdoing. A key portion of its criticism was redacted by DHS.

Trump issued his first travel ban with little warning and even less vetting. It’s understandable that the federal agents responsible for enforcing the order made a few early errors. But the OIG report reveals much more than that. It proves CBP officers knowingly violated federal court rulings, apparently out of an eagerness to exclude as many immigrants as possible. OIG has no power to punish these officers, who have faced essentially no consequences for their illegal conduct. The inspector general does, though, strongly recommend that CBP “consider ways to avoid” these “significant problems” in the future. That seems unlikely. As the report makes vividly clear, the only limit on CBP’s actions is the agency’s own sense of what it can get away with.