Detainees are seen at a facility where tent shelters are being used to house separated family members at the Port of Entry, June 21, 2018, in Fabens, Texas.
Detainees are seen at a facility where tent shelters are being used to house separated family members at the Port of Entry, June 21, 2018, in Fabens, Texas.

The Trump administration says a judge’s ruling requiring the government to reunite migrant children and their families who were separated at the U.S. border could result in the children being detained longer than currently allowed.

“The government will not separate families but detain families together during the pendency [duration] of immigration proceedings when they are apprehended at or between ports of entry,” the Justice Department said in court filings Friday.

Families could expect to be detained for months or even years because of the thousands of immigration cases backlogged in the court system.

A federal court settlement known as the Flores Agreement does not allow detained minors to be held for more than 20 days.

A U.S. District Court judge ruled Tuesday in San Diego, California, that separated families had to be reunited within 30 days and children younger than 5 returned in two weeks.

“The rulings work together to permit detention of parents with their minor children with whom they are apprehended,” the government said, adding that an “amendment of the Flores Agreement is appropriate to address this issue.”

Officials say about 2,000 children are waiting to be reunited with their parents.

Many Americans have been outraged by the wrenching televised scenes of families being torn apart and children being placed in cages in warehouses.

On Saturday, demonstrations will be held across the country, including Washington to protest the Trump administration’s zero-tolerance policy on illegal immigration.