Over the past two decades, the U.S. government has spent more than $130 billion to boost border surveillance and security. It has built hundreds of more miles of fences and more than quadrupled the number of Border Patrol agents.

You might think this massive militarization of the border would lead to fewer Mexican immigrants settling in Arizona.

A new study says you’d be wrong.

Lots of migration experts have tackled the difficult question of how tighter security affects illegal border crossings: How many people try anyway? How many look for someplace else to cross? How many stay home?

Economists Todd Pugatch and Sarah Bohn decided to try to answer another question: For those who make it across, does tighter border security affect where they settle?

Pugatch and Bohn looked at whether growing border security from 1994 through 2011, as measured by the number of Border Patrol agents, affected where migrants ended up within the United States.

Then — through complex formulas designed to correct for the effects of the economy, state laws and other factors — they estimated where migrants would have gone if border security hadn’t increased.

Their conclusion: Over those 18 years, tighter border security led massive numbers of Mexican migrants who would otherwise have settled in California and Texas to head to scores of other states — including Arizona — instead.

In other words, the researchers said: If the U.S. government had left the border as it was, Arizona (along with most other states) would have fewer Mexican immigrants today.

“We calculate that Arizona would have about 33,000 fewer Mexican immigrants than it does today due to the diversion of migrants away from California and Texas,” said Pugatch, an economist at Oregon State University and co-author of the study in the journal “Demography.”

“A lot of the shift, in terms of the scale of the change in settlement patterns, really comes from those immigrants who used to flow through California. That decline is huge compared to the increase in Arizona,” said co-author Bohn, an economist and research fellow at California’s Public Policy Institute.

Both researchers emphasized that their findings don’t speak to changes since 2011, or to state actions such as Arizona’s controversial adoption, in 2010, of Senate Bill 1070. That law, most of which was overturned in federal court, required local police to check the immigration status of people they arrested or detained.

Still, the study challenges current assumptions about the vast diaspora of Mexican immigrants into new parts of the United States over the past 20 years.

Jeffrey Passel, a demographer at Pew Research Center, said that in his view, the shift in where Mexicans immigrants settled owes more to the relative economic conditions in different states, and to earlier migration patterns within the United States, than to border enforcement.

“Economic conditions and opportunities determine a lot of where immigrants end up settling,” Bohn agreed. “And social networks are really strong. Why else would immigrants from one part of Mexico all go to Chicago?”

All the same, she described the data tying tighter border enforcement to an exodus from California and Texas as “cut and dried.”

In the early to mid-1990s, when Border Patrol agents were making more than a million apprehensions a year, the San Diego sector was by far the busiest part of the border. Some years, it accounted for half of all apprehensions along the U.S.-Mexico border.

In 1994, the first year of Bohn and Pugatch’s study, fewer than 4,000 agents worked along the Southwest border. Roughly a third of them worked in the San Diego Sector.

But as the government built new fences south of San Diego and ramped up the number of Border Patrol agents, border-crossers pushed east into the Yuma and Tucson sectors. By 1999, more migrants were being apprehended crossing through Arizona than through California, according to Border Patrol data.

As migrants pushed into new areas to cross, the Border Patrol increased the number of agents in those areas, too.

For example, the Tucson sector went from having 282 agents in 1994 to more than 1,000 by 1998 to more than 4,200 by 2011.

After 2008, the number of apprehensions along the border fell rapidly, to a low of just under 328,000 in 2011. Most demographers attribute the drop not to tougher enforcement, but to the economic recession, which made it hard to find work.

But if tighter enforcement didn’t prevent determined crossers, it did lead them away from Texas and California, according to Bohn and Pugatch. They went in larger numbers to states such as Illinois, North Carolina, Colorado, Nevada, Washington, Florida and many others. Even Alaska and Hawaii wound up with more Mexican immigrants than they would have otherwise, according to the study.

Bohn cautioned that this study did not look at the impacts of interior enforcement efforts, or of actions by individual states. She was part of a study that looked at an Arizona law, adopted in 2007, mandating the use of E-Verify, which required that employers check the work eligibility of job applicants. She said that study found E-Verify may have driven as many as 92,000 unauthorized migrants to move from Arizona to other states.

Both Bohn and Pugatch said their findings raise questions they hope will be answered by further research.