People at the “No Muslim Ban Ever” protest a new travel ban imposed by the Trump administration as they head toward the Trump International Hotel in Washington on Oct. 18. (Ricky Carioti/The Washington Post)

The Trump administration's botched rollout of its first travel ban led federal agents to violate court orders by telling airlines not to let certain passengers board U.S.-bound flights, according to an internal watchdog.

In a letter Tuesday, the Department of Homeland Security's inspector general, John Roth, notified lawmakers of the violations. He also alerted them that his findings have become bogged down in a battle with the department over redactions that he said would obscure the true failures of the administration's handling of the first travel ban.

In the early days of the Trump administration, the president signed an executive order temporarily banning entry to the United States by citizens of seven majority-Muslim countries, as well as refugees.

The move led to confusion and alarm at airports, where immigration agents were unsure how to enforce the order and passengers were unsure whether they could enter the United States. It also sparked protests at some major international airports.

The inspector general's letter is particularly critical of the leadership of the Customs and Border Protection agency.

"While CBP was compliant at U.S. ports of entry with travelers who had already arrived, CBP was very aggressive in preventing affected travelers from boarding aircraft bound for the United States, and took actions that, in our view, violated two separate court orders that enjoined them from this activity," Roth's letter says.

For instance, after a federal judge in Massachusetts issued a temporary restraining order on Jan. 29 instructing CBP not to notify airlines that passengers will be "detained or returned based solely on the basis of the Executive Order," government documents show that agents were doing precisely that two days later at Boston Logan International Airport.

Swiss Airlines, for example, was notified on Jan. 31 that a prospective passenger, a 31-year-old Iranian, would probably be denied entry to the United States. Dozens of similarly eligible travelers were not allowed to board flights that they should have been able to board, according to a person familiar with the inspector general's findings.

The letter notes that all airlines, with one exception, obeyed the CBP no-board instructions. Lufthansa took the position that it would allow such passengers to board, and when they arrived in the United States, they were permitted entry, according to the letter.

The investigation seems to lay the bulk of the blame for such behavior not with CBP officers stationed at airports but on senior officials.

The inspector general did not find evidence to support other claims of misconduct by CBP officers and found some personally paid for food and water for detained travelers.

Higher up the chain of command, however, senior officials seemed clueless at times about what the president's executive order actually said — who was allowed into the country and who wasn't, according to the inspector general. As was reported at the time, a key point of confusion within the government was whether the executive order barred entry of green-card holders, also called legal permanent residents.

"The leadership of CBP, the DHS entity primarily responsible for implementation of the order, had virtually no warning that the Executive Order (EO) was to be issued or the scope of the order, and was caught by surprise,'' Roth wrote in his letter to lawmakers. "During the early period of implementation of the order, neither CBP nor the department was sure of the answers to basic questions as to the scope of the order.''

DHS spokesman Tyler Houlton said in an email that officials "conducted themselves professionally, and in a legal manner, as they implemented an Executive Order issued by the President."

Having bungled the rollout of the order, DHS is now trying to keep the extent of the mismanagement hidden from the public, by proposing to redact large sections of his report on the subject, the inspector general wrote.

A copy of the 87-page report by Roth was sent to DHS leadership on Oct. 6, but since that time he has been locked in a battle with department lawyers over the proposed redactions, according to the letter. The Justice Department is also reviewing the report.

Of particular concern, Roth wrote, is that DHS is proposing using the "deliberative process privilege . . . which would prevent us from releasing to you significant portions of the report. I am very troubled by this development," Roth wrote to Sens. Richard J. Durbin (D-Ill.), Tammy Duckworth (D-Ill.) and Claire McCaskill (D-Mo.).

Roth said he had never before encountered an agency trying to use the deliberative-process privilege to keep secret parts or all of an inspector-general report.

"Invoking the privilege can mask . . . decisions made based on illegitimate considerations, or evidence of outright misconduct," he wrote to the senators.

Houlton said: "Material within the report is covered by privileges afforded by well-recognized law. This should come as no surprise as many of the activities in implementing the Executive Order were conducted amidst a large number of lawsuits and, later, court orders that shaped the Department's response."

After the first travel ban went into effect, judges at the district court and appeals court levels found it was unconstitutional. In response, the administration launched a second and then a third version of the order, changing which countries were affected and the legal rationale for each. Civil rights groups are still challenging the justification for the current version.