LOS ANGELES — A Trump administration filing with the U.S. District Court here argues that the government can detain parents and children together at the border for as long as it takes to prosecute them.

The filing is a response to U.S. District Court Judge Dana Sabraw's ruling in San Diego Tuesday that immigration authorities must stop separating migrant children from their parents and reunite about 2,000 children who have been detained separately since May.

The preliminary injunction in favor of an anonymous woman from the Democratic Republic of Congo, known only as Ms. L, meant that President Donald Trump's Department of Justice had two choices: Release parents and children or hold them together for 20 days, the limit for holding children under a 1997 court settlement known as the Flores settlement agreement.

Government attorneys have formally requested that the deal be modified so it can hold families together for the duration of the parents' prosecution for allegedly crossing into the United States illegally. But the Trump administration in the meantime is arguing that Sabraw's order gives it no choice but to hold families for prosecution.

U.S. Border Patrol agents arrive to detain a group of Central American asylum-seekers near the U.S.-Mexico border in McAllen, Texas. The group of women and children had rafted across the Rio Grande from Mexico and were detained before being sent to a processing center for possible separation. John Moore / Getty Images

"We believe that the Flores Agreement permits the Government to detain families together to comply with the nationwide order in Ms. L," a U.S. Department of Justice spokesman said. "We nevertheless continue to believe that an amendment of the Flores Agreement is appropriate to address this issue."

In the filing the Department of Justice says it will keep families together until the parents' cases are adjudicated, which can take months.

"To comply with the Ms. L injunction, the government will not separate families but detain families together during the pendency of immigration proceedings when they are apprehended at or between ports of entry and therefore subject to the Ms. L injunction," the "notice of compliance" reads.

Such a move was feared by immigrant advocates who believed all along that President Trump, in signing an executive order to end the policy of separating children from parents at the southern border, intended to detain families indefinitely.

The American Civil Liberties Union is disputing the Trump administration's interpretation of the ruling.

Lee Gelernt, deputy director of its Immigrants' Rights Project, said the government has a constitutional obligation to release parents who don't pose a flight risk or danger, and that parents can choose to release their children if they don't want them to be in a family detention center.

"Ultimately the (San Diego) case leaves it up to parents to decide what is in the best interests of the child," Gelernt said. "It would be flatly unconstitutional if the government's purpose in detaining families is punitive or is intended to serve as a deterrent."

The administration's policy of separating families was touted as a deterrent to illegal immigration by Attorney General Jeff Sessions and Chief of Staff John Kelly as early as last year, but a surge in migrants fleeing violence in Central America hastened the action, officials said.

Many of these people seek asylum in the United States after fleeing gang violence and threats in places like Honduras and El Salvador.

A policy of holding families whole beyond 20 days could necessitate the construction of new facilities. NBC News found that, based on government data and a detention rate at the southern border of 420 parents and children a day, immigration authorities will run out of room for them in a matter of days.