A generation ago, globalisation shrank the world. Nations linked by trade and technology began to erase old boundaries.
But now barriers are rising again, driven by waves of migration, spillover from wars and the growing threat of terrorism.
The numbers are clear: In 2015, work started on more new barriers around the world than at any other point in modern history.
There are now 63 borders where walls or fences separate neighboring countries - nearly quadrupling in just 15 years.
In many ways, the barrier-building is being driven by fear.
"We are fencing out the south, and much richer countries are fencing themselves in," said Elisabeth Vallet, a barriers expert at the University of Quebec at Montreal.
Britain is going further, rolling up its bridges to the continent by voting to exit the EU. Intended to counter migrants and terrorist attacks, these moves are not limited to Europe. In the Middle East, Tunisia is erecting a desert barrier with lawless Libya to insulate itself from unrest and an Islamic State-led insurgency.Most of the new walls are being erected within the European Union, which until recently was nearly borderless.
This new age of barriers is not just about chain links and concrete. It also reflects the rise of populist politicians. The effectiveness of their nationalist rhetoric suggests that even as globalisation was working its magic on trade, mobility and investment, a seditious resentment was brewing among those left behind.
Donald Trump has made no secret of his plan to build a wall along the entire US-Mexico border - and persuade Mexico to pay for it.
The Republican presidential nominee has been remarkably vocal about the proposal, one that 6 in 10 voters disagree with. The wall, he argues, is needed to curb illegal immigration, reduce gang violence near the border and stop drugs from reaching the United States.
For now, fences cover just 1125km of the nearly 3220km-long border. Hillary Clinton, the Democratic nominee, opposes completing the wall - but as a senator, she voted for the 2006 bill that led to construction of most of the existing fence.
The idea of "completing the wall" has been part of political rhetoric since the first 22km stretch was completed 23 years ago, jutting eastward from the Pacific Ocean.
But opinions remain divided on whether a barrier spanning the entire border is necessary - or even feasible. And nowhere does the debate roil more loudly than in the dusty cantinas and lively migrant shelters in the arid reaches of the border region.
Kilometre by kilometre, the landscape and culture along the border varies wildly. West of El Paso, through New Mexico, Arizona and California, where most of the existing fence has been built, the border is largely a series of straight lines drawn by men. But to the east, in Texas, it follows the winding path of the Rio Grande. Most of the border land here is still unfenced.
Fencing is just one part of the effort by US Customs and Border Protection to secure the country's borders. The number of Border Patrol officers has doubled in recent years. Where no fencing exists, cameras and sensors do.
Barrier construction in this area would be difficult because of the region's isolation and rough terrain. The federal government owns very little land in Texas, so a bigger fence would require the use of private land, adding to the legal and logistical challenges.
But most challenging of all, the Rio Grande is a natural feature - not a man-made boundary. Rivers erode the land they pass. They flood. They dry up. They sometimes change course. A completed border barrier would have to navigate these natural challenges.
Data released by CBP officials suggests illegal immigration has decreased since 2001, but it's difficult to show which specific policies made a difference. The Great Recession, which began in 2008, almost certainly deterred some economic migrants, researchers say.
Today, most deaths reported by the Border Patrol occur in the Rio Grande Valley in Texas, where most of the border remains unfenced, and in the Tucson area, which is mostly fenced. Border enforcement has pushed migrants off existing routes into more deserted areas. In southern Arizona, migrants walk dozens of kilometres through the desert, carrying water in plastic jugs.
Immigration is a complicated issue; a barrier along the border addresses just one part of it. An estimated 12 million undocumented immigrants already live in the United States, representing 5 per cent of the labour force.
Emma Sanchez embodies the intertwined nature of border protection and immigration policy. She is married to a US veteran and has two American children but was deported 10 years ago after being found without documents.
Every Sunday, dozens of deported mothers like her meet for a church service at Friendship Park, the only binational meeting place between the United States and Mexico. Situated at the west end of the border, on the coast of the Pacific Ocean between San Diego and Tijuana, the park provides divided families a chance to catch up with their loved ones - if only for a few hours, and only through an 5.5m-tall steel and mesh fence.
It is in Europe, not the American Southwest, where the cauldron of migration has truly begun to boil over.
Until the upheaval of 2015, Europe was home to the world's most open frontiers. But within months, a messy effort to halt a mass flow of migrants fleeing wars in Syria, Iraq and Afghanistan cascaded into the construction of more border fences than anywhere else on the globe.
The sheer numbers of migrant arrivals - nearly 5000 a day to southern Europe alone - was shocking, though at first, the newcomers had arrived largely unhindered,. Some Europeans welcomed the refugees, arguing that they had a moral duty to aid people displaced by war.
Yet a backlash quickly grew. The European Union had no system in place to properly vet the newcomers - at time when jihadists who fought in Syria with Isis (Islamic State) were seeking to reenter Europe. The fact that the influx also included economic migrants passing themselves off as asylum seekers did not help.
Hungary began building a fence in June 2015, with completion of the its barrier rerouting migrants toward neighbouring countries. By early 2016, Austria and other nations had banded together to halt migrant transit through the Balkans, and the EU signed a deal with Turkey to stop asylum seekers from crossing the Aegean Sea.
The combined moves left nearly 60,000 migrants trapped in Greece, with the single largest bottleneck forming in Idomeni, a border town that formerly served as a waystation for those heading deeper into Europe.
This coordinated effort largely worked. With the completion of each new fence, the flood of migrants entering that country slowed to a trickle. A combination of barriers and diplomacy sent a deterrent message to desperate migrants across the Middle East and beyond.
A continent that prided itself as the global standard-bearer for human rights is also confronting a moral dilemma
Even now, though some in Europe are now asking whether the new walls are enough. To prevent migrants from crossing the English Channel, Britain is funding construction of a wall in Calais, France. Austria is preparing to erect more barriers if migrant numbers again begin to surge.
There is reason for uneasiness. The EU deal with Turkey to halt the flow across the Aegean Sea is in danger of falling apart. European nations are charging Ankara with human rights abuses following a failed July coup attempt. Turkey has threatened to scrap the deal unless the EU honours its pledge to grant Turkish citizens visa-free access to the bloc.
The heavy weight of terrorism also hangs over the discussions, after revelations that attackers in Paris and Brussels entered Europe disguised as migrants. A wave of sexual assaults in Germany last New Year's Eve has further inflamed anti-immigrant sentiment.
And yet, a continent that prided itself as the global standard-bearer for human rights is also confronting a moral dilemma. A plan to resettle migrants stranded in Greece has broken down as European countries reneged on pledges to accept them and Greek officials have been slow to process asylum claims.
Although the EU offered to relocate 66,000 migrants, it has so far absorbed only a fraction of that number.
Those left behind appear willing to take fresh risks despite the new obstacles rising in their paths. Many will employ dangerous smugglers - precisely a pattern the Europeans say they were trying to break.
Europe's new barriers have made it impossible for hundreds of thousands of Syrians to escape relentless war. Their message is clear: Keep out.