On Tuesday, President Trump tweeted: “We cannot allow all of these people to invade our Country. … Our system is a mockery to good immigration policy and Law and Order.” Actually, the mockery is the White House whipping up the impression of a crisis at the border, failing to apply necessary discretion, carelessly separating families and now scrambling to deal with the inevitable, a judicial order to reunite those families.

All of this has been unnecessary, the cruelty to children, in particular, the American Academy of Pediatrics and other experts citing the likely damage to their physical and mental health. If the president wants to ramp up arrests and prosecutions at the border, then prepare for the consequences. That isn’t what has happened.

The mockery extends to House Republicans, unable, again, to find among themselves consensus on an immigration overhaul. The Republican leadership shows no interest in the bipartisan compromise almost certain to pass, combining enhanced border security with a path to legal status, or citizenship, for those undocumented immigrants who would qualify.

A federal judge in San Diego has set a tight timetable, requiring children under age 5 to be reunited with their parents in 14 days and older children within 30 days. There are more than 2,000 children separated, held at some 100 sites in 17 states.

If the White House has backed away from separating families, chastened by the uproar, it now seeks to detain families together. What it has yet to apply are proven alternatives as due process takes its course, especially for asylum seekers, many from crime- and violence-ravaged El Salvador, Guatemala and Honduras.

In 2015, the Department of Homeland Security initiated the Family Case Management Program, families put under the watch of social workers who help with housing, transport and legal counsel. Virtually all families attended their court hearings and meetings with authorities.

Unfortunately, in its zeal to appear tough, the Trump team abandoned the program. Neither has the administration made effective use of electronic monitoring, including GPS ankle bracelets. This has been the case though the paper trail of policymakers at Homeland Security reveals support for such steps. These approaches are less costly than detention while they help to fulfill the country’s legal obligation to hear requests for asylum.

For the president, all of this amounts to what he cudgels as “catch and release.” His demagoguery shouldn’t obscure what works, or what holds true to the country’s values of welcoming those who flee unbearable circumstances.

Which is what is taking place. Doctors Without Borders, among others, reports Salvadorans, Guatemalans and Hondurans contending with “unprecedented levels of violence outside a war zone.” These asylum seekers won’t be deterred by a lack of humanity here. They face worse. As they wait for the proceedings to unfold, they deserve the dignity this country is supposed to represent.