SAN SALVADOR, El Salvador – Andy Romero remembers when a tattooed man showed up in his neighborhood with baggy pants, T-shirts with rock band logos and sneakers like none he had seen before.

“His clothes were totally different,” Romero recalled of that time, in the late 1980s. “He wore kerchiefs on his head. His hair was all shaved off.”

He had a nickname – “Scorpion” – and had shown up after arriving on a flight of deportees from Southern California. Thousands of other gang members would follow Scorpion back to Central America, deported by U.S. immigration authorities.

American politicians now are debating how the United States should respond to the arrival in Texas of tens of thousands of adolescents and children, many of them fleeing violent gangs that have come to virtually control many parts of El Salvador, Guatemala and Honduras. What that debate generally has lacked is a recognition that U.S. immigration policies played a major role in creating the gangs that now are driving young people to flee to the United States.

Those who study the history of Central America’s gangs say that there is plenty of blame to go around and that strategies those countries adopted to deal with the returned gang members backfired. But there’s little debate that the gangs originated in the United States among a huge refugee population, then were exported back to Central America – often with little concern for the likely impact.

If one were to search for a beginning to the story of major gangs in Central America, it might involve the most mundane of settings: a convenience store parking lot on Westmoreland Avenue in Central Los Angeles where bored Salvadorans, offspring of refugees from this country’s civil war, gathered to pass the time.

“It started as what we refer to out here as a stoner gang: a bunch of kids hanging around and getting stoned all the time,” said Wes McBride, executive director of the California Gang Investigators Association.

The stoner group assimilated into gangs that already existed, particularly the 18th Street Gang, which had emerged among Mexicans in Los Angeles in the 1960s. By the early 1980s, Salvadoran youth broke off from 18th Street to form their own gang. They called it Mara Salvatrucha. “Mara” means gang, “salva” comes from the name of the country, and “trucha,” which means “trout,” also signifies “vigilant.”

Constant travel between the Los Angeles area – a major hub of émigré Salvadorans – and Central America meant that 18th Street and Mara Salvatrucha, or MS-13, got a foothold in El Salvador in the late 1980s and early ’90s. That’s why Andy Romero saw a deported gang member and eventually joined the Mara Salvatrucha himself.

A watershed moment for gang development in El Salvador occurred in 1996. That was the year that Congress passed the Illegal Immigration Reform and Immigrant Responsibility Act, radically altering how deportations were handled. Before the act, immigrants could be deported only if they committed aggravated felonies that carried jail sentences of five years or more.

The new law allowed U.S. law enforcement officers to deport migrants for crimes such as shoplifting, minor drug possession or even speeding. What followed was a surge in deportations of gang members back to El Salvador, rising into the thousands annually for the rest of the ’90s.

The move rid Southern California of part of its gang problem. But it overwhelmed El Salvador, where the civil war had been settled only in 1992 and institutions of government were just beginning to be established, including a new police force to be cobbled together from equal numbers of former police officers, former guerrillas and a third group unconnected to the other two.

Many deported gang members, who had arrived in the United States as young children, were unfamiliar with their country of origin. They barely spoke Spanish, and with gang tattoos on their arms, faces and necks, they found few job opportunities. They sought out other gang members.

“The culture of Los Angeles gangs fell on fertile soil here,” said Edgardo Amaya, a lawyer who writes a blog on security issues.

If the gangs were supercharged by the influx of deported U.S. members, some of them hardened criminals, a second watershed began in 2003, when Salvadoran leaders outlawed gang activity and swept thousands of members into prisons. The sweep had the unintended consequence of turning jails into hubs of gang coordination.

“The most capable, brightest gang leaders met each other in jail, and that’s when the jailed leaders started exercising control over the streets,” said Wim Savenije, a Dutch academic expert on Salvadoran gangs.

By 2011, El Salvador’s National Civilian Police estimated that the nation had 28,130 gang members, about 10,400 of whom were in prison. But the broader network of collaborators and family members is much larger.

Earlier this year, the Justice Ministry estimated that 600,000 Salvadorans – out of a population of 6.3 million – had some role in the gangs or received some benefit, said Amaya, the lawyer.

In 2012, the Obama administration declared Mara Salvatrucha an “international criminal organization” and alleged that the group’s leaders were ordering crimes across international boundaries.

Facts bear out that MS-13 members carry military-grade weapons and use brutal tactics, even hacking apart rivals from the hated 18th Street Gang with machetes and forcibly recruiting adolescents into their ranks.

Such violence is one factor in an unprecedented northward surge of unaccompanied children from Central America toward Texas. Since Oct. 1, more than 57,000 youths have crossed the border into Texas by themselves.