Congress likes to put fancy titles on its legislative handiwork, but they should probably just call everything the Law of Unintended Consequences, especially immigration bills.

The 1965 Cuban Adjustment Act gave all people fleeing that Communist island the right to legal residence once they reach U.S. soil. Over time, this evolved into the “wet foot, dry foot” policy, whereby the U.S. government could exclude a Cuban rafter caught in the surf off Key West — but not after he had touched the beach.

Many a desperate Cuban has perished at sea trying to avoid one U.S. agency, the Coast Guard, in hopes of reaching another U.S. agency, the one with the green cards, on land.

President George W. Bush signed the William Wilberforce Trafficking Victims Protection Reauthorization Act on Dec. 23, 2008, thinking he was fighting the global traffic in sex slaves, many of them children. The Democratic Congress that passed the bill agreed. Hence its title, an homage to 19th-century Britain’s greatest foe of the slave trade.

Half a decade later, the Wilberforce Act has mutated into a source of chaos, the victims of which are children, and the greatest beneficiaries, human traffickers.

This law’s special mistake was to guarantee an immigration hearing to unaccompanied minors arriving in the United States on the theory they might be victims of sex trafficking and to let them live with U.S.-based family, if any, until a judge was available.

Kids from next-door Mexico and Canada were excepted. But the bill’s authors apparently forgot about Central America or underestimated the desire of Central Americans who reside in the United States, with or without documents, to extract their children from violence and poverty back home, even at the risk of a dangerous journey north.

They failed to anticipate that trafficking mafias in Mexico would market temporary entry pending the delayed hearings as a new form of “permiso” (“permit”) and can charge families $10,000 per child to pursue it.

So, here we are: The Wilberforce Act, logical and humane on paper, has been overthrown by an influx of Central American kids that reached 10,146 in fiscal 2012, 20,805 in fiscal 2013 and 39,133 between last October and June 15, according to the Los Angeles Times.

They’re sprawled on the floors of dingy detention centers across the Southwest — if they didn’t get lost, kidnapped or killed during the 1,500-mile Middle Passage through Mexico. A boy from Guatemala, Gilberto Ramos, described variously as 11 or 15, recently perished near La Joya, Tex., while trying to get into the United States to earn money to help his mother.

If they do find their way to a stable home in the United States, the children will likely skip their far-in-the-future hearings and grow up undocumented, living in the shadows even under the version of immigration reform favored by President Obama — though maybe we can look forward to a brutal political debate over legalizing them a decade from now.

This isn’t anyone’s idea of sustainable immigration; at least it shouldn’t be. Some call the situation a humanitarian crisis. I prefer “national scandal.”

Obama, Vice President Biden and other senior officials have, belatedly, started countering trafficker misinformation in Central America. The president has a $3.7 billion plan to provide housing, services and the due process called for under the Wilberforce Act.

Yet the key is to fix the Wilberforce Act: to permit prompt exclusion of unaccompanied Central American minors, as is already the case for Mexicans and (far less frequently) Canadians. Only by showing people there is nothing to be gained by paying traffickers for the traumatic voyage through Mexico will the chaos cease.

To his credit, Obama voiced support for such a measure. Less to his credit, he omitted it from his proposal to Congress after 200 activist organizations urged him to reconsider; they argued in an open letter that it would leave Central American children at the mercy of criminal gangs back home.

But it is a sad fact the U.S. government returns migrants to horrible situations every day. Just ask the 1,357 Cuban rafters the Coast Guard plucked from the Caribbean in fiscal 2013. The gang problem is a perennial one in El Salvador, Honduras and Guatemala, not new. By the way, the United States is no perfect safe haven; Central American criminal organizations operate in several big cities.

Those who defend the status quo are defending a system that was well-intended but has proven to be riddled with loopholes that enrich criminal gangs, endanger children and, not incidentally, promote political backlash against immigration — which the United States needs — by associating it in the public mind with border chaos.

The rule of law is one of the benefits immigrants seek in the United States. Step one in dealing with the border crisis should be to reestablish it.

Read more from Charles Lane’s archive, follow him on Twitter or subscribe to his updates on Facebook.