The Trump administration announced Wednesday it would move to scrap a major court agreement in order to allow for migrant families to be detained longer as their cases are being considered, instead of having to release them after 20 days.

Acting Homeland Security Secretary Kevin McAleenan, in a press conference detailing the decision, claimed that the long-standing court order known as the Flores agreement has incentivized illegal immigration and represents a "loophole" in the immigration system.

That agreement prohibited children from being kept in detention for more than 20 days. As a result, officials were releasing entire families to keep them from being separated -- though last year, the administration did separate families as part of a "zero tolerance" program that eventually was stopped amid a bipartisan outcry.

BORDER PATROL NABS NEARLY 200 CENTRAL AMERICAN MIGRANTS NEAR NEW MEXICO PORT OF ENTRY

"Today, the government has issued a critical rule that will permit the Department of Homeland Security to appropriately hold families together and improve the integrity of the immigration system,” McAleenan said. “This rule allows the federal government to enforce immigration laws as passed by Congress and ensures that all children in U.S. government custody are treated with dignity, respect, and special concern for their particular vulnerability.”

The Flores ruling came about as a result of a 1980s case in which a girl named Jenny Flores, then 15, was detained with adults by U.S. authorities after she fled El Salvador. Beginning in 1997, the Flores settlement called for migrant children to be sent to care programs after 20 days, and be given access to medical treatment and visits with relatives. McAleenan said the new rule takes the place of Flores, while keeping many of its terms.

The new rule is slated to go into effect in 60 days, though the change is sure to face a new court challenge.

In July, at a House Oversight Committee hearing on Capitol Hill, Rep. Rashida Tlaib, D-Mich., accused McAleenan and other administration officials of seeking to scrap the Flores Settlement, with the alleged goal "to keep kids longer" in custody.

McAleenan pushed back against that characterization. He explained that he wanted to keep families together for the time necessary it takes for immigration proceedings to go through, and for the justice system to make a ruling on the case.

“We want to keep families together through an immigration proceeding that's fair and expeditious in an appropriate setting,” he said. “That can't be done in 20 days with due process."

Democrats have slammed the detentions as “inhumane." When the new rule was announced, the ACLU called it "another cruel attack on children," by allowing them to be held for longer than previously allowed.

"The government should NOT be jailing kids, and certainly shouldn’t be seeking to put more kids in jail for longer," they said.

Democratic presidential candidate Julián Castro vowed to end all detention if he wins the presidency.

"Separating migrant children from their parents is appalling—but indefinitely detaining families isn’t a better alternative," he tweeted after McAleenan's announcement.

Republicans such as Sen. Lindsey Graham, R-S.C., have claimed that the current system has resulted in children being used, repeatedly, by adults posing as family members to get into the U.S.

CLICK HERE TO GET THE FOX NEWS APP

“This is a sick system, it’s rotten to its core,” Graham told Fox Business Network’s Maria Bartiromo in July, stating that 30 percent of those who cross into the U.S. with children are “fake families,” and that loopholes are used to let the same children come back over and over, bringing different adults with them.

McAleenan said approximately 6,000 migrants fraudulently presented themselves as families in the past fiscal year.

"No child should be a pawn in a scheme to manipulate our immigration system," he said.

In addition to putting an end to the 20-day limit, the plans announced Wednesday also set standards for detention facilities, which have been criticized by members of both parties for not having sufficient resources to keep people in proper living conditions.

"The new rule establishes a high national standard for care of children and families in custody," McAleenan said, noting that maintaining proper standards of care is a "core" element of the new rule.

Fox News’ Dom Calicchio contributed to this report.