WASHINGTON (Reuters) - The Trump administration said on Thursday it plans to withdraw from a federal court agreement that strictly limits the conditions under which authorities can detain migrant children, and proposed new rules it said would enable it to detain minors during their immigration proceedings.

The administration has long targeted the Flores Settlement Agreement, a 1997 federal consent decree that places significant curbs on how long and in what conditions the government can detain migrant children as it seeks to dissuade migrants from crossing the U.S. southern border.

The regulation released on Thursday, if it goes into effect, would enshrine some of the protections while circumventing others, by allowing the government to detain children in facilities not licensed by state authorities to hold minors.

Immigrants and their advocates are expected to mount legal challenges to the move. The agreement has been interpreted over the years to set a 20-day limit on detaining children who entered the country illegally, and also requires facilities that house migrant children to be licensed by a state authority.

Trump administration officials have repeatedly referred to the agreement’s standards as “loopholes” that attract migrants by forcing authorities to release people pending their immigration hearings.

Secretary of Homeland Security Kirstjen Nielsen repeated that reasoning, saying in a statement that “legal loopholes” prevent the government from detaining and deporting migrant families.

“This rule addresses one of the primary pull factors for illegal immigration and allows the federal government to enforce immigration laws as passed by Congress,” Nielsen said.

Thursday’s regulatory filing said the government would seek to terminate the Flores settlement, and put forward regulations it said “parallel the relevant and substantive terms” of the agreement.

The new rules would ensure “that all juveniles in the government’s custody are treated with dignity, respect, and special concern for their particular vulnerability as minors,” the regulation said.

One significant change would be a new licensing system to allow authorities to hold children in detention centers that are not licensed by state authorities to hold children.

The facilities would be licensed by an outside auditor employed by the Department of Homeland Security that would ensure the sites comply with standards established by Immigration and Customs Enforcement (ICE), the regulation says.

The American Civil Liberties Union criticized the administration’s decision to withdraw from the agreement.

“It is sickening to see the United States government looking for ways to jail more children for longer,” said Omar Jadwat, director of the ACLU’s Immigrants’ Rights Project.

The administration earlier this year asked a federal court to ease the limits mandated by the Flores agreement, but the judge overseeing the agreement, U.S. District Court Judge Dolly M. Gee, rejected those requests.

That attempt by the administration came after it instituted a “zero-tolerance” policy at the U.S. border with Mexico that led to the separation of thousands of migrant children from their parents. After intense public outcry, the administration was forced to abandon that policy, but hundreds of children remain separated from parents who were deported without them.

The public has 60 days to comment on the proposal, followed by a 45-day period before the court settlement is terminated.