WASHINGTON — The Justice Department urged a federal judge Thursday to let the government detain migrant families for long periods, a critical part of President Donald Trump's plan for ending the practice of separating children from their parents at the border.

"The emergency currently existing on the Southwest border requires immediate action," said the government's filing, asking the court "to help address this urgent problem."

Since 1997, an order from a federal district judge in California has set limits on how long children can be detained by immigration authorities. Originally intended to protect only unaccompanied minors, it was amended in 2015 to cover children held with their parents. Under the order, children must generally be moved to an approved facility for minors within 20 days.

As long as that limit remains in force, Justice Department lawyers said, the government must either separate the child from the parents or release the family members while they wait for their immigration hearing. But release is not a desirable option, the government said, because many families fail to show up for their hearings and simply remain in the country illegally.

When the court set the revised limit in 2015, in response to the Obama administration's effort to hold children in detention with their mothers, it sent a message that families seeking to make the dangerous journey to the U.S. can expect to be released once they get here, Thursday's court filing said.

As a result, the government said, the number of illegal family border crossings has tripled. "This surge is not a mere coincidence. It is the direct result of the message sent to those seeking illegal entry: we will not detain and deport you."

The court's 2015 order was affirmed by a federal appeals court. But it said that "relaxing certain circumstances" might be appropriate if conditions changed. Now is the time, the government said, because the earlier order "incentives a dangerous journey by family units with young children."

U.S. District Court Judge Dolly Gee of Los Angeles oversees the settlement, named for the original plaintiff, Jenny Flores. If the judge rejects the request, the administration can take the case to the 9th Circuit Court of Appeals in San Francisco and from there to the U.S. Supreme Court.