A directive to immigration officials across the country to try to portray undocumented immigrants swept up in mass raids as criminals came directly from then-Secretary of Homeland Security John Kelly, The Intercept has learned.

Earlier this month, The Intercept published a cache of internal emails exchanged between Immigration and Customs Enforcement officials in Texas in February, while the first mass raids of the Trump administration were underway.

The redacted emails, obtained through a Freedom of Information Act request by students at Vanderbilt University Law School, show that while hundreds of undocumented immigrants were rounded up across the country, DHS officials tried — and largely failed — to engineer a narrative that would substantiate the administration’s claims that the raids were motivated by public safety concerns. In the emails, local ICE officials are ordered to come up with “three egregious cases” of apprehended criminals to highlight to the media.

The February raids ­— the first in an ongoing series under this administration — led to 680 arrests nationwide, including arrests of dozens of individuals who had no criminal history. In Austin, Texas, where 51 people were arrested, the majority of those arrested had no criminal record.

But while dozens of undocumented immigrants were detained, the administration sought to shape the narrative that “by removing from the streets criminal aliens and other threats to the public, ICE helps improve public safety,” according to statements by the agency.

On February 10, as the raids kicked off, an ICE executive in Washington sent a directive to the agency’s chiefs of staff around the country. “Please put together a white paper covering the three most egregious cases,” for each location, the acting chief of staff of ICE’s Enforcement and Removal Operations wrote in the email. “If a location has only one egregious case — then include an extra egregious case from another city.”

As a reader of The Intercept pointed out, the email’s subject line — “Due Tonight for S1 – URGENT” — meant that the request had been made by the secretary of Homeland Security himself, referred to as “S1” in department shorthand.

Kelly was at the helm of the department at the time, before he was appointed in July to replace Reince Priebus as White House chief of staff.

The White House and DHS did not respond to requests for comment. ICE issued a statement in response to The Intercept’s original story, but did not answer questions about what officials meant by “egregious cases” and why they felt the need to highlight such cases in the media.

In Texas at least, ICE officials struggled to fulfill Kelly’s request.

A day after the original email, an agent at ICE’s San Antonio office sent an internal email saying the team had come up short: “I have been pinged by HQ this morning indicating that we failed at this tasking.”

“As soon as you come in, your sole focus today will be compiling three egregious case write-ups,” an assistant field office director at the agency’s Austin Resident Office wrote to that team on February 12, noting that the national and San Antonio offices were growing impatient. “HQ and SNA will ping us in the afternoon for sure.”

Then the agent added that a team of officers had “just picked up a criminal a few minutes ago, so get with him for your first egregious case.”

Top photo: White House Chief of Staff John Kelly calls on a reporter during the daily briefing at the White House in Washington, Oct. 12, 2017.