Immigration officials said Tuesday they are detaining an illegal immigrant Dreamer because of his gang ties, sparking a new round of protests from immigrant-rights groups who said President Trump is breaking his own promises by trying to deport the young man.

Daniel Ramirez, who was picked up by ICE agents late last week, was granted a temporary deportation amnesty by President Obama under his 2012 policy known as Deferred Action for Childhood Arrivals, or DACA.

But U.S. Immigration and Customs Enforcement (ICE) said he’s a “self-admitted gang member.” That puts him in violation of the DACA policy and would have made him a priority for deportation even under President Obama, much less Mr. Trump.

“ICE officers took Mr. Ramirez into custody based on his admitted gang affiliation and risk to public safety,” said agency spokeswoman Rose Richeson.

Immigrant-rights groups have complained about Mr. Ramirez’s arrest, saying it’s the latest evidence that Mr. Trump is trying to make good on his promise to oust illegal immigrants from the country.

“Daniel must be given his freedom, now,” said Greisa Martinez, advocacy director at United We Dream. “Under Trump’s America, no one is safe. Donald Trump and Republicans must say in no uncertain terms that DACA recipients are safe.”

The groups are rallying to protest every immigration enforcement action, hoping to bloody Mr. Trump’s nose now and head off an escalation later.

They said Mr. Obama promised that those approved under his DACA policy would be protected from deportation and would be granted work permits, entitling them to driver’s licenses and taxpayer benefits.

But approval was always discretionary and Homeland Security said it retained the right to go after targets — and said Mr. Ramirez had become a target because of his gang affiliation.

Indeed, the Obama administration itself said membership in a gang was enough to disqualify someone from DACA, and the administration even went back and revoked permits of some illegal immigrants whose gang memberships were only discovered after they’d already been approved.

Lawyers have gone to court to try to get Mr. Ramirez released, and a judge has set a speedy briefing schedule. The Trump administration must file papers by Thursday justifying why it has Mr. Ramirez in custody.

ICE said it encountered Mr. Ramirez on Feb. 10 at a residence in Des Moines, Washington, while trying to find another target, a felon who’d been deported before.