Updated

The Department of Homeland Security was “caught by surprise” by the signing of President Trump’s executive order temporarily banning immigrants from terror hotspots into the U.S., a government report released Friday concluded.

The report by DHS’ Office of Inspector General found that Customs and Border Protection (CBP), assigned to implement the Jan 27 order, “had practically no advance notice that the order would issue, or that it would be effective upon signature.”

It also found that DHS had no chance to offer input into the drafting of the document, which banned those coming in from Iraq, Yemen, Iran, Libya, Somalia, Syria and Sudan for 90 days. The consequence appeared to be chaos and agents were acting with a distinct lack of information.

“Answers to critical questions necessary for implementation were undefined when the EO issued. No policies, procedures, and guidance to the field were developed. Nevertheless, the EO took effect immediately, while travelers from the affected countries were in the air and thousands more were preparing to travel,” the report found.

It was not just at the offices of the DHS and CBP where the executive order hit hard. Activists and politicians rushed to airports to protest the ban and world leaders lined up in condemnation of the move, which was blasted by critics as Islamophobic as it targeted a number of Muslim-majority countries.

The ban would be stayed by a federal court a day later, and the legal fight would lead to a number of court cases, and multiple redraftings of the ban. Now, nearly a year later, the modified ban is in effect and will be taken up by the Supreme Court later this year amid a number of continued challenges to its constitutionality.

The report found that after legal guidance was given, particularly after a stay was granted for certain travelers, CBP implemented that guidance quickly and consistently across all ports.

It did, however, conclude that there were two instances in which court orders were not followed. One order from a Boston federal court told CBP to notify airlines with Boston-bound flights that provisions were stayed, yet the report found that the agency told airports not to board passengers heading to Boston. Days later, an L.A. court told CBP not to block any related passengers, but the agency continued to issue “no board” instructions, backed by the threat of fines.

The report also pointed to reports in the media of inhumane conditions, lengthy detentions, abuse and other mistreatment. The Office of the Inspector General found that some of those allegations were “simply untrue” while others resulted from “factspecific circumstances.”

Responding to the OIG, DHS blasted the report for “a number of legal and factual inaccuracies” and described it as “methodologically flawed.”

It claimed the alleged violations of the court orders that the OIG found came from a double obligation to comply with both the court’s order and the executive order at the same time.

The department also said the report failed to acknowledge the "extraordinary" work done by many DHS agents during those first days after the executive order.

“The Department of Homeland Security offers no apology for lawfully implementing the President’s and Congress’ mandates,” the DHS response reads.