If it is ever built, President Donald Trump’s much-vaunted wall, which is supposed to stretch for nearly 2,000 miles along the United States’s border with Mexico, would be the largest infrastructure project since the U.S. highway system, estimated to cost $18 to $40 billion. But as David Frye reveals in his new book, Walls: A History of Civilization in Blood and Brick, the idea of constructing barriers to keep others out—or, in the case of the Berlin Wall, to keep people in—is as ancient as human civilization. Only the people being shut out have changed.

When National Geographic caught up with Frye by phone at his home in Connecticut, he explained how the ancient world was split between wallers and non-wallers, how the Berlin Wall set a precedent by being the first wall to keep people in, and why America and so many other nations are “forting up.”

President Trump gave the idea of excluding outsiders with walls a contemporary twist when he vowed to build a “big, beautiful wall.” But he is latching onto something ancient, isn’t he?

It is an ancient idea. People have been building walls since the tenth millennium B.C. The ancient walls were built primarily for defensive purposes. Nowadays, they are built more to prevent immigration, terrorism, or the flow of illegal drugs. But there is a common connection, which is the idea of keeping outsiders out.

Trump’s proposed wall on the southern border of the U.S. would stop the flow of immigration from Central and South America. Another motive is to stem the flow of drugs from across the border. The latter would be something very modern. You wouldn’t find that in the histories of Rome, Persia, or China, or any of the great wall-building states of the past.

As for immigrants, oddly enough Rome was very open to immigration. In fact, it was an issue in Rome going back to the first century B.C., when people were arguing, “Do we have too many immigrants moving into this city?” It remained an issue for hundreds of years but Rome remained a city of immigrants. At the same time, Rome was building walls for a very different, military purpose. They were worried about invasion, which is in a way a different kind of immigration, an immigration of armed masses coming across the border.

Let’s go back in time to the first walls. Who built them and why?

The first walls were city walls and they originated with the very first cities, like Jericho, the city of the Bible, which was first constructed sometime in the tenth millennium B.C., as many as 12,000 years ago. It was a walled city and, subsequently, nearly all cities in the ancient world were walled.

The first border walls aren’t found until the late 2000s B.C., in Mesopotamia. Security is why they were built. There were two different lifestyles developing: a lifestyle of the people I call wallers, who are workers who build things and identify themselves by their civilian occupations. They sought to secure themselves by building structures that would protect them even when they were sleeping at night. Outside the walls, you have a very different sort of society, people inured to the dangers of living in an un-walled world. Non-wallers were peoples we generally refer to historically as barbarians, like the Huns, the Goths, or the Mongols. They were viewed with fear by the wall-builders. And that’s what inspired the construction of the early walls.

You write, “No invention in human history played a greater role (than walls) in creating and shaping civilization.” Some people might vote for writing or gunpowder. Make your case.

I would make the case that there would be no writing and nothing as complex as gunpowder without first the construction of walls. The ancient human need for security is one of the fundamentals of life and has to be achieved before we can achieve other things. It was walls that gave people the security to sit and think. It’s hard to imagine a novel being written in a world in which every man is a warrior. Until a society achieves security, it can’t think about anything except the dangers all around it. As a consequence its culture will be limited.

The most famous ancient fortification, which many erroneously believe can be seen from space, is the Great Wall of China. Give us a sense of its context, and the huge toll in human life it took to build.

U.S.-Mexico Border Wall: Are Animals at Risk? The proposed border wall raises many questions and controversies. But one thing that's certain is its effect on wildlife. This animated video explains which animals are in danger—and how the entire ecosystem would be disrupted.

The Great Wall of China can’t be seen from space. That’s a common misconception. And it is actually fairly recent. The stretches of brick walls that most tourists see weren’t built until the 16th century A.D. But the Chinese had a history of wall building that goes back much longer than that, to the Bronze Age. The first true wall, though, was constructed in the late third century B.C. by the first Emperor of China. This is the birth of the Chinese state and the birth of the long wall, and the two events occur simultaneously and are very much connected. In English, we would say they were trying to keep out the Huns. Chinese sources would say the Hsiung-nu. They also built walls in southern China against various other peoples, like the Miao, from Vietnam.

It’s interesting that the sorts of complaints that were made about the ancient wall, in particular in China, always had to do with how much work was required. At times, millions of Chinese were displaced and forced to go north to these dangerous regions where they were worked like slaves. Many of them were never able to return home but were forced to settle in the new cities that were built along the wall to support the troops.

This is encapsulated in a folk legend about the first of the great walls of China: the story of the weeping widow. Her husband is drafted to go off and work on the wall but finds the conditions too difficult. He’s beaten daily by a supervisor and tries to escape. When he returns, his supervisors put him to death. His widow comes to the wall in search of him, where she hears of his death and immediately begins to gush tears. Those don’t relent for 10 days, until the wall has been washed away.

Another famous barrier dates back to Roman times. Why was Hadrian’s Wall constructed, and how did it fit into the Roman view of the world?

Amongst historians there is some debate over the purpose of Hadrian’s Wall. In the surviving ancient sources it’s clear that it was built to keep the barbarians out. It runs across the neck of Britain, about two-thirds of the way up the island, and its narrowest point is about 80 miles from end to end. It was originally about 15 feet high.

It was built by the Emperor Hadrian around 122 A.D. That’s when the Romans became wall builders. Of course, they had built walled cities. Rome, itself, was walled. But in terms of border walls, that was a policy that originated with Hadrian and briefly became very important. We have this beautiful oration by the Roman writer Aristides, where he is talking about how the empire has become a paradise, how war no longer exists and how Romans no longer believe that war ever existed. They have come to see it as a sort of myth created by old men, while they go about happily to their gymnasiums, theaters, and libraries. It’s all peace within the empire. And Aristides attributed those conditions to the walls that girded it.

The walls of Byzantium, or Constantinople as it is also known, played a crucial role in defending western, Christian civilization. Explain why, and how “The Horrible Bombard” effectively made walls as defensive structures obsolete.

[Laughs] The city of Constantinople was the capital of the Byzantine Empire. When Islamic armies first spread out of Arabia, in the seventh century A.D., and started heading west, they were able to sweep aside the defenses of most of the Byzantine Empire and, in the early eighth century, cross into Spain. The city of Constantinople proved a tougher nut to crack, though. It held out for hundreds of years, becoming the headquarters of the defense of the Western world against Islam.

But when the Sultan Mehmed II besieged Constantinople in 1453 he had a new weapon. There had been various techniques of siege craft before, but they were very difficult and slow. Cannons changed all that, ultimately making city walls obsolete. They had been around for about 100 years but there had never been a cannon like this before. The sultan had a Hungarian foundryman make for him an enormous cannon that could fire stone balls seven feet in circumference from a distance of a mile. This was referred to as the Horrible Bombard by one of the sources and it relentlessly battered the city walls of Constantinople in the spring of 1453, when the city eventually fell.

The most famous wall of modern times was, unusually, built to keep people in, rather than out. Describe the Berlin Wall’s historical context —the Iron Curtain—and the mythology it inspired in books and movies.

The Berlin Wall was constructed for an unusual purpose, which was to stem the flow of emigration from East Germany into West Germany. There were barriers between East and West Germany except in the city of Berlin, which was partially controlled by Western powers and partially controlled by East Germany. Until 1960, people could freely cross from one side to the other as part of their daily shopping or commute. But the East German economy was on the verge of collapse because of all the people that were fleeing to the West. So, in August 1961, they roll out the barbed wire, all in one night. It became known as Barbed Wire Sunday, when the people of Berlin woke up to this new feature of their landscape.

But the Berlin Wall was originally regarded by Western leaders with some relief. John F. Kennedy said, “A wall is a hell of a lot better than a war.”

What they were worried about in 1961 was that something could spark thermonuclear war. It was the journalists who had a different point of view because many happened to be in Berlin when the barbed wire was rolled out. David Brinkley was there, for example, and was taking film footage of the crowds swarming the train stations, trying to get out of East Berlin at the last minute. So it was journalists who turned this into a worldwide cause celebre. The next thing you know, it was appearing in magazine articles, books, detective novels, and movies. The Berlin Wall became one of the most famous pieces of architecture on Earth.

I was surprised to read, at the end of your book, that, far from declining, wall-building is enjoying a renaissance in modern times. Tell us about today’s walls and why Americans are “forting up.”

That’s not my expression, I took “forting up” from some earlier authors. The short answer is that, as people become more accustomed to security, they have a lower threshold for what triggers their insecurity. When you talk about forting up, you’re talking about the proliferation of gated neighborhoods, homes with security fences, hedges, guard dogs, and even guns, around them.

The funny thing about so many of the walls today is that they’re being built for the same purpose walls were constructed 2,000 years ago, which is to keep out emigrating Syrians. The first border walls ever constructed were fortifications against invading Syrians. Today, we’re seeing the same thing in Turkey, Hungary, Bulgaria, and across southern Europe, because of mass emigration and fear of terrorism. We’re even seeing walls in Saudi Arabia, India, Tunisia, Libya, Jordan, and Ecuador. All around the world countries are building walls. In all, over 70 different countries have fortified their borders.

This interview was edited for length and clarity.