Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

BOSTON — The American Civil Liberties Union has filed a lawsuit challenging what it calls a pattern by President Donald Trump’s administration of detaining undocumented immigrants seeking to legalize their status based on marriages to U.S. citizens.

The proposed class action was filed late on Tuesday in federal court in Boston and alleges that immigration officials have been illegally separating families while a noncitizen spouse was seeking lawful immigration status.

“These actions are not only inhumane but they are unlawful,” Adriana Lafaille, a lawyer with the ACLU of Massachusetts, said at a press conference.

The lawsuit came amid calls by Trump for Congress to stop legal immigrants from sponsoring extended family members who want to move to the United States through what he has characterized as “chain migration.”

The lawsuit centers on regulations the U.S. Citizenship and Immigration Services (USCIS) enacted during former Democratic President Barack Obama’s administration aimed at encouraging people living illegally in the country to seek lawful status.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Under regulations enacted in 2016, undocumented spouses of U.S. citizens could go through a process to seek waivers that would allow them to largely remain in the United States rather than leave the county while pursuing permanent residency.

But the lawsuit said U.S. Immigration and Customs Enforcement (ICE) has been detaining people who were going through that process and in January alone arrested seven people while they were at a Massachusetts or Rhode Island USCIS office.

The complaint contended the administration’s actions stemmed from a “racial animus and animus based on national origin,” noting that Trump during his election campaign referred to Mexican immigrants as criminals and rapists.

The lawsuit contends the administration’s actions violate the Immigration and Nationality Act and are unconstitutional, and seeks an injunction to prevent further similar detentions.

John Mohan, a spokesman for ICE, declined to comment.

The class action claims were added to an earlier case centered on Lilian Calderón, a Guatemalan immigrant who was arrested at a government office in Rhode Island in January after an interview that was part of the process to seek legal status.

Calderón, who was brought to the United States when she was 3 years old in 1991, was detained for about a month and was only released after the lawsuit was filed. She said her two children now have nightmares due to her abrupt arrest.

“I’m not the only one who was detained that has family that was going to their interview,” she told reporters.

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM