In the wake of the deaths of two migrant children, outgoing White House chief of staff John Kelly blamed former Attorney General Jeff Sessions for the policy that separated children from their parents at the border.

“What happened was Jeff Sessions, he was the one that instituted the zero-tolerance process on the border that resulted in both people being detained and the family separation,” Kelly told the Los Angeles Times in an interview published Sunday. “He surprised us.”

Sessions, whom President Trump fired after the midterm elections in November, announced the zero-tolerance policy in May, saying it would act as a deterrent to immigrant families because children would be separated from their families.

“If you cross the border unlawfully, then we will prosecute you. It’s that simple,” Sessions said at a press conference at the border.

Kelly, who is leaving the White House on Wednesday, said the announcement caught the Department of Homeland Security unprepared and left DHS Secretary Kirstjen Nielsen holding the bag.

He wouldn’t directly answer a question about whether Trump manufactured a migrant invasion at the border before November’s elections but did say, “We do have an immigration problem.”

He blamed immigrants and members of Congress — not the White House — for the situation at the southern border, where thousands of migrants from Central America are stranded in Mexico while seeking asylum in the US.

Two Guatemalan children — Jakelin Caal, 7, and Felipe Gomez Alonzo, 8 — died in December while in custody of Customs and Border Protection.

“One of the reasons why it’s so difficult to keep people from coming — obviously it’d be preferable for them to stay in their own homeland but it’s difficult to do sometimes, where they live — is a crazy, oftentimes conflicting series of loopholes in the law in the United States that makes it extremely hard to turn people around and send them home,” Kelly said.

“If we don’t fix the laws, then they will keep coming,” he added. “They have known, and they do know, that if they can get here, they can, generally speaking, stay.”

Kelly, a retired four-star Marine general, also said Trump has backed away from his demand for a concrete wall on the border — a contentious issue that has left the White House and congressional Democrats at an impasse, resulting in a partial government shutdown.

“To be honest, it’s not a wall,” he told the newspaper.

“The president still says ‘wall’ — oftentimes frankly he’ll say ‘barrier’ or ‘fencing,’ now he’s tended toward steel slats,” Kelly said. “But we left a solid concrete wall early on in the administration, when we asked people what they needed and where they needed it.”

When he was DHS secretary, Kelly said, CBP officials advised him about keeping immigrants from crossing the border.

“They said, ‘Well, we need a physical barrier in certain places, we need technology across the board, and we need more people,’” Kelly said.