But for the tall, copper-coloured fence, it would not be obvious to the casual visitor that there are two Nogales. The Arizona version, population about 20,000, sits next to its Mexican namesake in Sonora, which is 10 times larger. Many of the shops on the main street blast banda music, and the shoppers converse in Spanish. Although the cities are divided, they are still referred to together as Ambos Nogales (both Nogales).

The fence, which stretches along 650 miles of the nearly 2,000-mile long border between the US and Mexico, has become far more than a physical barrier. To some it is a symbol of unjust division; to others an ineffectual barrier to stop unwanted immigration.

President-elect Donald Trump’s pledge to build a “big, beautiful wall” and make Mexico pay for it struck a nerve. He has continued to reiterate the promise, telling a press conference last week, “I don’t feel like waiting a year … I’m going to start building.”

For three years, I have been working on a history of Hispanics in the US, and I wanted to return to the border, the centre of this debate. Cities such as Nogales remind us that it will take more than a wall to cut through the tangled history of these two countries.

Around 6 million of the 11 million undocumented people in the US are from Mexico, and “Mexican” is often used as shorthand for all Spanish-speaking migrants. While the idea of the wall may represent a halt to all immigration, at the heart of this discussion is the complex relationship between the US and Mexico.

One family straddling both worlds is that of 18-year-old Angelica, who asked that her surname not be used. She and her three siblings were born in the US to undocumented Mexican parents.

When she was 12, her family had a serious deportation scare in Arizona. They were on their way to a nearby lake when they were pulled over by police. Arizona had recently passed the controversial SB 1070 legislation, which allows law enforcement officers to ask people for immigration papers on routine stops, such as a traffic violation.

Isabelle Rodrigues speaks with a relative through the US-Mexico border fence in Nogales, Mexico Photograph: Sandy Huffaker/Getty Images

Angelica’s family was allowed to proceed after her father’s licence was checked, but the incident left them shaken. “Fear was running through our veins every single day,” she said. “So, we decided to exit voluntarily.”

They returned to Jalisco, Mexico. “It was really difficult,” she recalled. “The children were mean … just because I didn’t know the language very well.”

She decided to return to the US for high school, and is finishing her final year. At first, Angelica lived with relatives, but her immediate family soon followed her back. Her parents were granted temporary US visas but at the moment they are in a legal limbo. “When I was in Mexico I didn’t feel like I fit in,” Angelica said. “This is where I belong and where I want to be.”

Although the border, and the immigration laws that underpin it, profoundly affects the lives of people like Angelica, it is a relatively recent development. Much of today’s south-west United States was Native American land that was claimed by the Spanish in the early 16th century, until Mexico started its fight for independence in 1810. Indeed, the first immigration problems between America and Mexico concerned US settlers in the Mexican state of Coahuila y Tejas. They staged a rebellion that led, in 1836, to the independence of Texas, which later joined the US as a state.

The Mexican-American war followed, after which 51% of Mexico’s land was ceded to the United States. This territory now makes up Arizona, New Mexico, California, Nevada, Utah, and parts of Wyoming and Colorado.

Then, in 1853, the US negotiated the Gadsden Purchase, paying $10m ($270m today) for a strip of land in southern Arizona and New Mexico that was ideal for railways. Mexicans living in the region either had to move south to Mexico or become US citizens. As the saying goes, they did not cross the border, the border crossed them.

Lydia Otero, associate professor in the department of Mexican American studies at the University of Arizona, lives this history. There are Mexican-Americans, like her, “who don’t have a migration story”. Her family’s roots are in Tubac, Arizona, about 25 miles from the border. The Oteros were granted land there by the Spanish in the late 18th century, and she also has Native American Apache ancestry. But such longevity is losing its social currency.

“Two years ago I was walking downtown [in Tucson] and somebody rolled down their window and said ‘go back to where you came from’,” she said. “So, those kinds of assumptions based on the way I look are very real here.”

Mexicans first began to cross the border in significant numbers during the upheaval of the Mexican revolution (1910-20). However, the initial concern of the US Border Patrol, which was established in 1924, was Chinese people trying to find a way around the Chinese Exclusion Act 1882.

When the Great Depression hit, Mexicans in the US bore the brunt. Hundreds of thousands were deported or frightened into leaving. Yet when the second world war began there was, once again, a need for more workers. The result was the bracero programme – named for the Spanish term meaning “labourer” – which started in 1942 and allowed the issue of guest-worker visas to Mexicans. It brought some 4.5 million people to the US.

By the 1950s there was public concern that too many braceros, as well as undocumented people, had entered. So, in 1954, Operation Wetback deported around 1 million supposedly undocumented Mexicans. Trump alluded to the success of this programme during the presidential campaign, but it has been dismissed by others as inhumane and ineffectual. While it was happening, the bracero programme was still in place – it would not end until 1964.

Mexican immigrants were joined in the 1970s and 80s by central Americans fleeing instability and violence. The 1986 Immigration Reform and Control Act allowed amnesty for some 3 million people. Thirty years on, the backlog for immigration cases stretches for years.

US Border Patrol agent Nicole Ballistrea watches over the US-Mexico border fence. Photograph: John Moore/Getty Images

Margo Cowan, an immigration attorney in Tucson, says Trump’s plan for deporting even 1 or 2 million people is impossible because of this. “There is nothing about immigration that is simple,” she said. “So, when you talk about ‘I’m going to deport everybody’, you have no idea what you’re saying.” As for the wall, Cowan thinks it is equally unlikely: “There won’t be a wall. We all know there won’t be a wall.”

A couple of hours’ drive east of Nogales is John Ladd’s ranch, which runs up to the border fence. His family has raised cattle for 120 years, and he has seen big changes, not least the building of the current fence after the Secure Fence Act 2006 and the installation of cameras. But, he says, it is no deterrent to the drug cartels. “Since 2012, we’ve had 54 pickups full of marijuana cut the wire down, go through the ranch, get to the highway,” he said. “That’s how well the wall works.”

For Ladd, a legal work-visa scheme would go a long way to help, although he also thinks anyone caught crossing illegally should be jailed. “I’m not cold-blooded enough to say I don’t care about those people,” he said, “but that isn’t our problem, and we have laws. And if you break the law you go to jail.”

Standing on Ladd’s land, peering though the steel mesh fence, a white pillar is visible. These were placed on the border by US and Mexican authorities in the late 1800s to give permanence to what were only lines on a map. Looking at the brown earth stretching to the mountains in the horizon, it is hard to see which side is which.

Carrie Gibson is the author of Empire’s Crossroads. Her history of Hispanics in the US will be published by Grove Atlantic in 2018, and she presents La Frontera on Radio 4 at 8pm on Monday 16 January