Washington (CNN) -- It was a good idea back in 2008, in the final days of the Bush administration.
With almost no opposition, Congress passed a new law to protect immigrant children from sex traffickers trying to bring them to the United States. It required judges to hold hearings for youngsters from countries other than neighboring Mexico and Canada, preventing them from possibly getting turned away at the border.
More than five years later, though, the William Wilberforce Trafficking Victims Protection Action Act is having unintended consequences. It contributes to the surge of child migrants from Central America overwhelming the U.S. immigration system.
Now some in Congress want to change the law -- a possibility that could bring more unintended consequences.
How did a law aimed at sex traffickers play a role in Central American kids coming here?
A desire to crack down on the global child slave trade led to the law named for a 19th Century British abolitionist. President George W. Bush signed it the month before he left the White House.
It ensured that children who came to the United States got a full immigration hearing instead of being turned away or sent back. The goal of the hearing? To determine if the children had a valid claim for asylum.
Here's the catch: The immigration courts are so backlogged that it can take years for a child's hearing date to come around. As they wait, most stay with relatives or friends already in the country, attend school and generally go about their lives.
It didn't take long for word to spread to families in Central America: Send the kids, and they'll end up in immigration limbo with little threat of deportation -- all the while getting a decent education.
Why does it take so long for a hearing?
One reason is that Congress has failed to provide enough money for timely hearings, noted Michelle Mittelstadt, director of communications and public affairs at the Migration Policy Institute, an independent non-profit.
From 2002-2013, Congress increased spending on immigration enforcement by 300%, compared with a 70% increase for the immigration courts, she said.
Now the average wait for a hearing is well over a year -- and federal agents have too many cases to chase after everyone who skips a court date.
What else is behind the wave of children from Central America?
Rampant gang crime and faltering economies in Guatemala, Honduras and El Salvador have pushed a growing number of people to want to leave, especially those with relatives in the United States, the Migration Policy Institute says.
Sophisticated smuggling rings flourish with promises to take children through Mexico and across the border into the United States -- even if it takes more than one attempt. Their fee: Several thousand dollars at least.
Then in 2012, President Barack Obama's administration stopped deporting some children living illegally in the United States. It was part of a broader effort to overhaul the immigration system that has stalled due to Republican opposition.
The policy change applied only to those who had been in the country at least five years, but the smugglers ignored that nuance in their sales pitch.
How many children are we talking about?
The government says up to 90,000 children will arrive on their own this year, compared with about 39,000 the Border Patrol detained last year.
According to Border Patrol statistics, 98% of them come from Mexico, Guatemala, Honduras and El Salvador. The statistics show the influx from Mexico dropped dramatically in the past two years, while the flow from the other three rose.
What happens when the kids get here?
The goal is to enter the U.S. immigration system, so many approach border patrol agents to get taken into custody when crossing the Rio Grande Valley into Texas from Mexico.
If from Mexico, they can be turned back -- what is called a voluntary repatriation -- after an initial screening at the border. All others get held by the Border Patrol for up to three days, then must be turned over to the Office of Refugee Resettlement, a part of the Department of Health and Human Services.
During the process, some get bused or flown to holding facilities in other states, leading to protests by local residents unhappy that the immigrants are coming to their town.
According to the Migration Policy Institute, 90% of those turned over to the ORR eventually get released into the care of a parent, relative or family friend while they await an immigration hearing.
Stories from a desert bus station
Can the 2008 law be changed to help fix the problem?
Republicans and some Democrats want to change it so all child migrants can be sent back without a full immigration hearing, like those from neighboring Mexico and Canada.
Democratic leaders oppose revising the law, saying the government can speed up immigration hearings without any changes.
A plan unveiled Tuesday by two Texas legislators -- Republican Sen. John Cornyn and Democratic Rep. Henry Cuellar -- sought a middle ground. It would stop requiring hearings but allow children to request one, which would have to take place within 72 hours.
Senate Majority Leader Harry Reid of Nevada told reporters the proposal was "too broad," adding "it does more than just address the border problem."
What's the hangup?
Another Democrat, Sen. Dick Durbin of Illinois, said children at immigration hearings must have legal representation.
The Cornyn-Cuellar proposal lacks such a requirement, but relies on existing law that calls for the government to seek free legal counsel for the youngsters.
Cornyn warned that would prolong the hearing process to "serve the goal of some of the people who want to come because it would be years before they were ever deported."
The White House says it is open to any formulation that speeds up the process while respecting the rights of the children.
What is the government doing about this?
Obama has asked Congress for $3.7 billion in emergency funds to deal with the problem, including $1.8 billion to provide temporary care for children in government custody.
Another $1.6 billion would bolster customs and border efforts while cracking down on smugglers, and $300 million would help Mexico and the three Central American governments discourage parents from paying smugglers to get their children to the United States.
So far, Republicans are balking at Obama's request, saying they will come up with a smaller plan, including changes to the 2008 law.
Meanwhile, the Department of Homeland Security announced Monday it sent about 40 recent arrivals -- including adults and children -- back to their home country of Honduras. It said more removals to the three Central American nations were expected soon.
What if Congress doesn't act?
The Obama administration says it will seek ways for Homeland Security Secretary Jeh Johnson to speed up removals under the existing law.
It has transferred resources from other parts of the immigration system to better handle the surge, with a goal of quicker hearings for the children.
Mittelstadt of the Migration Policy Institute said faster hearings would resolve cases before the kids get turned over to family or friends in the United States, eliminating a major incentive for coming in the first place.
CNN's Ted Barrett and Deirdre Walsh contributed to this report.