The Trump administration has made it clear it will aggressively move to deport young immigrants from Central America who it determines have ties to the violent MS-13 street gang. But in a lawsuit filed last week against federal agencies, the New York Civil Liberties Union said that federal officials are holding young adults — even those without suspected gang ties — indefinitely and illegally.

The civil rights organization filed a class-action suit in Federal District Court in Manhattan on behalf of a 17-year-old native of El Salvador, who has been in federal custody since July, after he was arrested by agents for United States Immigration and Customs Enforcement at his home on Long Island. He did not get a hearing before an immigration judge until December, when Judge Amiena A. Khan of New York declared he was not a safety or flight risk.

But he has still not been released, and his lawyers say that the government is holding him because of its political agenda to deport as many undocumented immigrants as possible.

“The consequence for those who are being accused is huge, irreparable harm,” said Donna Lieberman, the executive director of the New York Civil Liberties Union. “MS-13 is a problem, gangs are a problem.”