Then, in 2010, Ms. Brewer signed the “show me your papers” law, which gave the police broad powers to question anyone suspected of being in the country illegally. It fueled national protests and boycotts, but also helped her win a second term, creating two images of Arizona: to some, a synonym for intolerance; to others, an example of how fed-up citizens and elected officials could fight back against illegal immigration.

Representative Ruben Gallego, a Democrat from Phoenix, said in an interview, “Our immigration laws have been a very effective tool to mobilize the right, and it’s once again going to reward a politician who’s going to be preying on people’s anxieties, be it Cruz or Trump.”

Today, the state has fewer undocumented immigrants than it did in 2009, according to an analysis by the Pew Hispanic Center. And based on census numbers, scholars at the Morrison Institute for Public Policy at Arizona State University projected that four in five of the state’s Latino residents will be a United States citizen by 2030.

Apprehensions by the Border Patrol have been on the decline, falling by 25 percent in the last fiscal year alone, in part because Mexico’s improved economy has given fewer of its citizens reason to risk the perilous crossing.

Still, profound challenges remain, fueled by geography — the border between Arizona and Mexico runs for about 370 miles — and opportunity. This month, Border Patrol agents arrested a convicted sex offender who had previously been deported as well as a man wanted for murder in Maricopa County as they tried to enter the country illegally.