WASHINGTON — The Trump administration did not tell key government agencies about its “zero tolerance” immigration policy before publicly announcing it in April, leaving the officials responsible for carrying it out unprepared to handle the resulting separations of thousands of children from their families, according to a government report released on Wednesday.

The Department of Homeland Security, which apprehends border crossers, and the Department of Health and Human Services, which cares for separated migrant children, were both caught off guard when Attorney General Jeff Sessions announced plans to criminally prosecute anyone who crossed the border illegally, the report said.

“There must be consequences for illegal actions,” Mr. Sessions said before dozens of sheriffs from counties on the United States’ border with Mexico.

Because they did not know about the “zero tolerance” policy in advance, officials at the Department of Homeland Security said, they did not take steps to prepare for the resulting family separations. Staff members at the Department of Health and Human Services said their leaders told them not to prepare for an increase in children separated from their families because homeland security officials claimed that they did not have an official policy of separating parents and children, according to the report, which was prepared by the Government Accountability Office, Congress’s nonpartisan investigative arm.