Mr. Azar said his department is holding 2,047 separated children, only six fewer than it held last week when Mr. Trump signed the executive order.

Raj Shah, a White House spokesman, conceded that the process of reuniting families would be difficult. “This is a complex situation,” Mr. Shah told CNN in an interview. “Our goal is to fully reunite as many families as possible, as quickly as possible.”

Yet in the lawsuit, filed in the United States District Court in Seattle, the attorneys general for the states noted that Mr. Trump’s order last week did not apply to families already broken apart, nor did it prevent the tactic from being used in the future.

A top official at Customs and Border Protection said Monday that the agency would cease referring parents traveling with minor children for criminal prosecution in order to keep families together. But White House officials said Monday that the change was temporary and only being carried out because the government would soon run out of space and resources to detain families together.

Amid the chaos, the first lady, Melania Trump, who traveled last week to a facility housing undocumented children who had been separated from their parents at the border, has planned another such visit this week, according to a spokeswoman.

The president, emboldened by the Supreme Court’s validation of the travel ban, continued on Tuesday to rail against immigration laws that afford those fleeing danger and persecution in their home countries the chance to have their asylum claims adjudicated by a judge. “If they step on our land, they have judges — it’s insane,” Mr. Trump said. He said the United States should adopt stricter laws that send an unmistakable message that only immigrants who have special skills to boost the American economy should be allowed into the country.

“It’s called, ‘I’m sorry, you can’t come in. You have to go in through a legal process,’” Mr. Trump said of his approach, during a lunch at the White House with Republican members of Congress. “I have to let people come in, but they have to come in through a merit. They have to be people that can love our country and help our country.”