# What would cause city walls to return?

Essentially, what would, in a modern (21st century) society, cause city walls to return?

• I don't necessarily mean stone walls; steel, titanium, and aluminum walls are perfectly acceptable.
• This setting includes modern weaponry like rockets and guns, and also near-future weapons like railguns. It does not include WMDs like nukes.
• Make sure that any answer is resource-viable; i.e., no solid palladium walls.
• The purpose of these walls should be city defense.
• I'm willing to budge on the definition of "city", a large town is fine, but no miniature hamlets.
• Defense against guerrilla warfare is OK, but I would prefer the walls to also be able to defend against large-scale military assaults.
• People are still using all the techniques of modern warfare; not just a wall of infantry.
• Undocumented migrants :) Jan 4 at 1:42
• GIant sand storms. Hippos that breed like rats. Jan 4 at 1:56
• in the past I am not so sure but nowadays it's politic ;D Jan 4 at 2:45
• @JustinThymetheSecond I think that was just a joke about the ill-conceived US border wall, not a comment on actual immigrants. Jan 4 at 13:59
• would Isreal's Iron Dome, meet the definition of a "wall"? Jan 4 at 22:56

# Lots of low grade military action.

Steel walls are already common in cities where crime is high.

Having steel shutters over vulnerable things is normal and expected in society. This is enough to deter casual vandalism and small calibre fire. Some nations take it further.

Israeli buildings are often built with steel reinforced concrete, because of the risk of random bombings, and often have safe rooms with thicker walls.

If you have a ring of such houses in a town, you have a wall basically. The walls would be built with thick concrete, reinforced with steel, and the windows have steel shutters to protect them.

# The West Bank walls should also be an inspiration.

About 90–95% of the barrier will be constructed as a "multi-layered fence system"[27] with the Israeli Defense Forces' preferred design having three fences with pyramid-shaped stacks of barbed wire on the two outer fences and a lighter-weight fence with intrusion detection equipment in the middle; an anti-vehicle ditch; patrol roads on both sides; and a smooth strip of sand for "intrusion tracking".[28]

On average, the barrier contains a 60-metre (200 ft) wide exclusion area.[29] Some sections are wider (up to 100 metres (330 ft)) due to topographic conditions.[30] The width of some sections (about 6% of the barrier) is 3 metres (9.8 ft) where the barrier is constructed as a concrete wall up to 8 metres (26 ft) high. These sections are narrower, require less land, and provide more protection against snipers. Wall construction is more common in urban settings, e.g., Qalqilyah and Jerusalem, and in areas where people have been killed by snipers, e.g., the Trans-Israel Highway.[31]

You can't stop a big invasion, but walls can make it hard for snipers, car bombers and such to attack a city and slow down an invasion for long enough for troops to be rallied inside. Concrete walls are of course very expensive, but Israel builds them around urban areas, so your city can do the same.

• Since you mentiones Israel: They basically have a "city"wall to some of their neighboring/disputed areas, including gates where you can pass during the day and so on Jan 5 at 13:51
• I've added that. Jan 6 at 11:51
• It should be clear: when your expected action is against a sophisticated military with aircraft, artillery, or even just tanks, walls are essentially useless. But if your expected adversary consists of infantry or militia without heavy-weapons support, walls remain an effective defense and deterrent. And, even against direct-fire heavy weapons, certain wall designs (see: star fort) can be effective. Jan 6 at 16:08
• Yeah, a wall isn't gonna defend against people dropping big bombs in the middle of a city. You'd need a massive steel dome for that. Jan 6 at 16:16
• "If you have a ring of such houses in a town, you have a wall basically" This is exactly how city walls worked in parts of the ancient world such as Jericho. The city wall served as the rear wall of houses. It's unclear whether the houses were built into the wall or if the wall was built from the houses, but the overall effect is the same.
– bta
Jan 6 at 16:39

Rising sea levels

A coastal city-state, like Monaco or Singapore, would be extremely vulnerable to global warming and sea level changes, and the world economy would have a strong interest in protecting the financial sector in those states. So it would make sense for Monaco and Singapore to invest in sea walls.

Other cities with important waterways and financial importance might also build sea walls: London, Rotterdam, New York, Tokyo, Mumbai, Rio de Janeiro, Dubai, Panama City.

• I immediately thought of this too, however I think given the whole question, the requirement The purpose of these walls should be city defense means defense against attack, not defense against the environment and/or natural disasters. Jan 5 at 22:11
• Applied in The Expanse (TV Show). Global warming went as predicted and coastal cities had to raise walls in order not to be flooded. i.redd.it/7klkuxgrct441.png
– Olaf
Jan 6 at 10:48

## Monsters or Zombies

I cannot imagine there are many scenarios that call for giant walls around civilian populations.

So the question is basically, what kind of threat would change the world enough to make nations build walls around their cities.

It would have to be an enemy.

An enemy that can operate freely across large amounts of a nation without serious fear of aerial attack or military confrontation.

Likewise, your hypothetical enemy cannot pass en-mass as normal people. They need to be something that scouts could see coming. An army, or monsters, or aliens or something in that vein.

If they can pass as civilians and walk in the gates with a little acting, then there's not much point in having the gates/walls to begin with.

Your enemy is indiscriminate and willing to harm civilians, otherwise the fortresses would be purely military and the cities would have much less defense.

It's also a sustained threat.
The military can't simply stamp it out once and for all.

In much the same way as medieval society couldn't stamp out banditry and considered its own neighbors to be sufficiently dangerous that they invested heavily in fortresses and armies.

Your foe is not air-borne. They have no ability to fly over walls and paradrop in.
Your foe lacks the kind of artillery that can bypass a wall.

Those last two pretty much preclude any inter-nation warfare, because any nations able to attack one another like that would possess one or both of those abilities.

Your foe must continue to reproduce itself despite the best efforts to kill it.
It will take years to build walls like these. The threat needs to be sustained for that entire time without being so apocalyptically dangerous that those cities were wiped out before they could do it.

Your foe must be widespread enough to threaten cities across a huge region. Perhaps not the entire nation, but enough for there to be multiple cities that use this. So it's almost certainly not an environmental threat like dust-storms or suchlike, and in any case that would likely bypass the walls anyway.

Your foe must be a great enough threat to make a physical wall a sensible option.

We're talking, in short, about monsters, because the conditions that made it make sense with people no longer exist.

Maybe Zombie hordes. Or something else that cannot be allowed to gain a foothold in a city.

Perhaps Kaiju-like giant monsters that are stopped by the physical walls and driven off or killed by the heavy defensive guns and weaponry there.

Something that takes too much time to kill to deal with before it reaches a major civilian population and inflicts massive casualties.

• Defense against people infected with COVID 19 even? Jan 5 at 22:12
• A chain-link fence with checkpoints would probably be sufficient for that. You don't need a 20 foot reinforced concrete city-wall to keep unarmed civilians out :P Jan 6 at 9:32
• The anime Attack on Titan is probably a good example of this kind of thing, While the Titans are large, the three walls are big enough that they can't get over or through them, at least not without being vulnerable to cannon and soldiers, until the appearance of the Colossal Titan. Jan 6 at 12:14

## Political oppression

Source: Wikimedia Commons

The Berlin Wall encircled West Berlin from 1961 to 1989. The official aim of the Berlin Wall was to protect the city against fascist agitators coming to stoke unrest. Does that count as city defence? Of course, the real aim of the Berlin Wall was that residents of the German Democratic Republic could not get to West Berlin uncontrolled. That's ultimately also a form of defense, because the East German regime would have collapsed with uncontrolled emigration.

Source: Wikimedia Commons

There is no technological reason why such a wall could not serve exactly the same purpose in the 21st century.

• For that separation, a fence would be enough, or better, because you could see an attempt to cross it or provide help to cross it. There is some kind of cultural separation. It is hard to ignore it see border patrol behind a fence, but you can totally get used to a wall. Nothing special, except the round part on the top, which makes the use of grappling hooks much harder. Jan 6 at 13:31

High crime rates, high gun ownership, drug lords operate without effective intervention, the continual defunctionalizing of the American police forces, and the criminal/quasi-legal terrorist organizations concentrate in particular cities, necessitating civilized society to defend itself within 'safe cities'.

I would actually extend this to particular regions within individual American states.

America already has gated communities, just extend it to gated cities.

EDIT: You might want to research the beginnings of the Pinkertons National Detective Agency. The walls would most likely be built and maintained by private contracted security firms, for profit.

After the war, Allan Pinkerton returned to his duties at the detective agency, which was often hired by the government to perform many of the same duties that are now regularly assigned to the Secret Service, the FBI, and the CIA. The agency also worked for the railroads and overland stage companies, playing an active role in chasing down a number of outlaws including Jesse James, the Reno Brothers, and Butch Cassidy and his Wild Bunch.

On their three-story Chicago building, their logo, a black and white eye, claimed: “We Never Sleep.” This was the origin of the term “private eye.”

Despite the challenges, by the early 1870s, the agency had the world’s largest collection of mug shots and a “criminal database.” During the height of its existence, the Pinkertons had more agents than the standing army of the United States of America, causing the state of Ohio to outlaw the agency, due to the possibility of its being hired out as a “private army” or militia.

• I feel this answer needs some more to it, but it was where i was going to go. +1 Jan 4 at 5:52
• @DWKraus I suppose I could add extreme income distribution inequity and the great decide between have and have-not cities, but who would ever believe that? A city of 10 million billionaires in a country of extreme poverty? Nah, will never happen in America. Jan 4 at 14:43
• Actually, that WOULD be really good. Parts of my city are ringed on each side with highways and giant soundproofing walls. It feels very much like a neighborhood in a fortress. But there are only 614 billionaires in the USA. 10 million would be income distribution! 22 million millionaires, but millionaire doesn't mean what it used to. Jan 4 at 16:13
• @DWKraus With the financialization of the American economy, billionaire doesn't mean what it used to mean. There are a LOT of billionaire families - the combined wealth of the family unit. Jan 4 at 23:00
• And here I thought "private eye" came from "P.I." as in "private investigator"... Jan 5 at 20:19

I can think of one city on particular that remains walled to some considerable degree to this day, and that is Jerusalem.

Jerusalem has its main, infamous wall for the primary purpose of formalizing a boundary between the Palestinian and Israeli-controlled parts of the city. You could also reimagine the many checkpoints around Jerusalem as walls, which gives you a very strong reason for putting walls both in and around your modern city; control. It gives the powers that be very accurate information on who is where within a city, and in the event of urban warfare, it makes control over specific sectors of the city much easier. Perhaps it's more common in divided cities like Jerusalem or Berlin after the second world war, or it's an element of an authoritarian government that uses the walls and checkpoints to maintain an eternally vigilant watch on all of its citizens, for whatever reasons that might be.

As for the material specifications of the Israeli wall in Jerusalem, it is more than just one thing. It is layers of barbed wire fence and tall concrete slabs. At some points it is just a fence, and at others, it is towers of beige concrete topped with barbed wire. I would recommend that, unless the nation in control of this city has access to ridiculous wealth and resources that it is willing to put into this infrastructure project multiple times over for many cities it intends to wall up, that the walls are variable like this. No need to partition the suburbs with 20-foor high towers of imposing concrete; a tall and sturdy fence should do just fine.

Strategically, including walkways on top of the walls gives a very optimal position for soldiers with long-range weapons, and sniper towers could also be added, increasing the strategic benefit.

The major reasons as I understand that we dont wall all of our cities is that modern cities are absolutely massive, they're constantly expanding and changing layout, and that walls made of strong modern materials are insanely expensive. If you walled in all of L.A. Proper, you'd have a wall that is 342 miles long. It would take about 4 and a half days to walk that if you didn't stop. In this, it just becomes less reasonable to wall a city than it was when they were so much smaller. Now, we have paratroopers and handheld missile launchers and other technologies that just make walls a lot less advantageous than they were in the middle ages.

Ultimately, I do not see walls being a widespread phenomenon in any state that is not 1984's Oceania levels of obsessed with the control and whereabouts of its citizens, but also, I as a fellow worldbuilder urge you to just wall the damn cities if you really want to. It sounds cool, and for me, that's usually enough. Hope this helps! ^^

• The Berlin Wall was 111.9 km (69.5 mi) long. 5× longer could work. Jan 4 at 15:51
• @gerrit That's fair, but the Berlin Wall was also significantly shorter in height and made of cheaper materials than would make sense for modern city walls. It was mainly, as I understand, to deliniate the line between East and West Berlin, and to prevent illegal crossings between the West Berlin and East Berlin occupation zones. A modern wall intended to protect a city from outside threats of the same length would be way more expensive, especially surrounding the whole city instead of partitioning it in half.
– INPU
Jan 4 at 16:06
• The Berlin Wall did surround the whole city of West Berlin. The part between West Berlin and East Berlin was most iconic, but it also separated West Berlin from Potsdam and from the East German countryside to the north and west of West Berlin. Jan 5 at 8:20
• I like a lot about this answer, but one thing is off. Larger cities are proportionally cheaper to wall off than smaller ones because the area of any polygon increases faster than its perimeter as you scale it up. So, per capita, it would be much cheaper to wall off LA than it was to wall off all those Ancient->Renaissance cities that had them. We also have much better technology now for doing large scale construction; so, even doing a wall of the same size would be much cheaper. Jan 5 at 18:15

Prolonged World War 3, lasting decades if not generations, assuming the nuclear warheads don't already wipe us out and somehow all the governments remain intact.

Even in middle ages walls don't typically enclose cities, they enclose keeps. Wealthier lords might build a second wall to enclose the urban class, but most of the population remained outside. This is not unlike gated communities and military compounds of today.

Walls directly impede transportation and commerce. In order for the security offered to outweigh economic benefits of free access the community needs to be under constant threat, and somehow that threat must not be missiles and bombs.

• "Even in the middle ages" I'd be careful about where you're talking about, there. The nature of central and western fortifications in those times was a little different to that in eastern europe, the near east or china. Jan 4 at 17:04

## A Poorly Defined Civil War Zone

There are plenty of reasons to build a wall in a modern context (segregation, immigration control, socio-economics, etc), but when it comes to repelling an attack against large-scale military assaults... they are pretty much useless. So to answer the question, we need to take some liberty in defining what a large-scale military assault means. In a modern or near-future conflict, it includes satellite recon identifying the wall and over-the-horizon weapon systems flattening it well in advance of your actual military operation making it totally useless in a conflict between 1st world powers... however, first world powers protect national borders, not individual cities. In a conflict where individual cities or towns require their own fortification, it is safe to assume that the belligerent forces are mostly interspersed and messy. And may lack the backing of official governments to provide most of them with 1st world weapon systems.

Rather than being a war between well organized militaries, this war is fought largely by small and poorly organized republics, dictatorships, and militias seeking to carve up and/or preserve the remnants of a larger collapsed government. So, if you had something similar to the Yugoslav Civil Wars where a federation breaks up along ethnic boundaries as opposed to geographical ones, you get very poorly defined battle lines where cities, towns, and even individual neighborhoods will find themselves themselves surround by enemies, so they build barricades to block roads, and walls around their neighborhoods knowing that it only takes a handful of racists in the neighborhood next door to march into yours and kill everyone in their sleep.

So, while a wall will not do much to stop a tank or artillery, it can limit the actions of insurrectionists, terrorists, etc. which in the case of a poorly defined civil war zone may actually be your greatest threat.

Well-connected military contractors plus scare campaign

Let's have a quick look at what putting a wall around a city will do:

1. Cost the government a ton of money that will be unavailable from funding combatant units and equipment. (Note that only an affluent society will have enough money available for this project at all.)
2. Require a cleared zone either side of the wall to stop placement of ladders, demolition charges etc - rendering otherwise valuable land unusable, again requiring an affluent society that can afford to sacrifice the land and willingness to displace the people currently occupying this land.
3. Massively impede the movement of civilians across the city's "border".
4. Provide zero protection against manned aircraft.
5. Provide zero protection against aerial drones.
6. Provide zero protection against indirect fire artillery - guns, mortars, rockets.
7. Provide zero protection against a person armed with a direct fire weapon (eg rifle) who can occupy a location that looks down across the wall from any outside location within range.
8. Provide a minor inconvenience to ground forces attempting to breach the wall, although modern weapons and demolitions will have little trouble with it.
9. Provide a medium- to long-term cash stream to the corporation winning the contract to construct the wall (this will not be an overnight job).
10. Provide a long-term cash stream to the corporation tasked with maintaining the wall.

In short, a wall will not protect against any enemy of significance but is a cash bonanza to a corporation that can get a contract to build and maintain it. Points 1, 2 and 3 will make it an extremely unpopular project with the populace, especially in light of its obvious limits in providing protection, which in a democracy will require a scare campaign in order to allow the project to go ahead.

Notes:

• Point defence - I can see someone jumping up and saying "But a really good system of point defence will shoot down all the incoming aircraft, drones, artillery shells etc and the wall will stop the infantry and tanks. My preemptive reply is that any point defence gun capable of knocking down a salvo of even 81mm mortar bombs travelling at hundreds of metres per second will have much less trouble with the PBI (Poor Bloody Infantry) travelling at a fraction of that speed, while the tanks will blast through any conceivable wall unless they are actively stopped.
• I am not arguing that walls (and fences) have no use, they are quite useful in site protection against low level threats such as protesters, infiltration, observation, theft, trespass etc. However, it will at most delay slightly military forces that are serious about breaching it.
• Even if we could build a wall that would cause more than a token delay to a military force, building a city-sized fortified dome on Earth or any 1+G world is totally infeasible with current technology.
• You get even more money out of accepting the contract and not building the wall. You may be able to get cost overruns for your motions as long as you don't. So if they are that corrupt, no way.
– Mary
Jan 4 at 13:13

Dangerous Animals

The animals we have now on Earth are largely non-threatening to humans and do not intentionally prey on us for the most part. However, a different setting could have a different species occupy the top of the food chain and actively hunt humans, so that humans need walls around their cities to prevent these animals from getting inside. Imagine carnivorous elephants or dinosaurs or something like that.

• Needs to be something not so easy or unable to hunt to extinction and populous enough that you can't just have patrols. Lol. Carnivorous elephants. Jan 6 at 19:58
• Disease-carrying small animals in large quantities are almost impossible to hunt. yet walls will keep them out. Jan 13 at 12:24

In the OP you mentioned that rockets are contemporary warfare, but airborne attacks (from a bomber or missile etc.) still carry warheads or other bombs so walls are kind of useless if you can fly over them. Unless you want to dial the warfare back to preindustrial I don't think walls would be effective for any warfare related reason.

However, walls are useful for other reasons such as traffic control (control people and hence goods entering a city), wildlife control (animals, while are dangerous like humans, don't use modern tools that render siege defense useless), weather control (flooding, etc.), and, depending on the city's architecture, aesthetics.

A city which has been built in the middle of the sea. Walls were built to protect the people from tides. Pumps removed the water so that they could have dry land. Of course, a 'sea-city' would be expensive, hard to build and probably not worth it. But, you could have an amazing tourist industry

• Have you heard of the Netherlands? Never mind trying to protect a city; much of their country is below sea level. Jan 5 at 19:32
• That's a good idea actually! If a city was on a floodplain (I know the Netherlands is not a floodplain, but if the sea level rose it could be flooded) it would need very waterproof walls to ensure the city stayed dry Jan 7 at 15:47

An Escape from New York Scenario

If you haven't seen this classic movie, the premise is that the people of the USA built a wall around New York to keep the crazies and the criminals in. So it is a wall for defense, just not for defense of the city, actually the defense of the rest of us. They did something similar with Los Angeles in the sequel. If we did that in the real world, some might say it would be... a good start.

• The purpose of these walls should be city defense.
• Defense against guerrilla warfare is OK, but I would prefer the walls to also be able to defend against large-scale military assaults.
• People are still using all the techniques of modern warfare; not just a wall of infantry.

Firstly, it wasn't tagged reality check, but I think you need one.

### Walls are undesirable for modern warfare

Firstly, walls mean nothing to modern large-scale military assaults. Consider the Atlantic Wall during WWII. Not a wall per se, but a network of costal defences designed to keep any invading force at bay. It was circumvented in the Battle of Normandy in part by using the third dimension.

A siege with modern weapons means artillery shells, bombs dropped by planes, missiles fired from cruisers or drones, or intercontinental missiles with any payload you want. You can look at Israel, with an (alleged) state-of-the-art missile defence system, and rockets still find their way into something. I wouldn't want to stand under that Iron Dome against an enemy with more budget and more high-tech weaponry.

And you start getting into why walls are undesirable. Walls mean siege, and obliteration over surrender. It's the exact opposite of the open city doctrine. Nobody likes to surrender, but consider the fate of Paris in 1940 with that of Berlin in 1945. French authorities didn't defend Paris. They let the invading force in without a fight. Nazis later clinged on Berlin at significant cost. And the cost here isn't just property damage and lives, it's also historical buildings, museums, and other things you can't just replace. Popular opinion is certainly going to be divided on whether it's worth the cost, but there will be a point where the cost becomes too great.

In that kind of scenario, to defend a city you need more than static defences, simply because what you might consider modern siege weapons can be placed way beyond reach of the defender. Japan in 1945 is a great example of that. Down to ships that couldn't move and planes that couldn't take off, they were unable to stop the onslaught of bombers coming at them. The US never intended to invade. They could have kept bombing the country forever, and there's nothing Japan could have done about it, because the airbases were out of reach, and the air defences were annihilated in the course of the war. The use of that brand new weapon changed nothing. Japan had already lost at least six months prior.

That's the fate of a city with walls in a modern warfare scenario. Either you have an army left outside of your walls to try and take the threat out, or you surrender (unless of course you prefer obliteration).

So, that's one thing walls are definitely not going to be used for.

### Wall, what is it good for?

If modern city walls are going to defend against one thing, it will be natural disasters. Floods most likely. In fact, here's a modern wall. It's a cheaper solution than moving an entire city. But it's a stop-gap fix, not a solution. Maybe a downfall of civilisation scenario where the few cities left standing have to fend off against chupacabras, walls could be useful there.

If you're thinking Berlin Wall and Iron Wall, that really didn't do much to prevent the fall of the USSR and East Germany. I think it might even have been counterproductive. These walls were more symbolic than protective. What prevented an invasion was the accumulation of forces behind the walls, and/or the sheer politics of it. These walls weren't impenetrable by far.

It will be marginally useful against intrusions from private citizens, which is why we bother putting walls around important buildings. So closed cities, or some kind of modern Forbidden City, or a Green Zone. But against any moderately organised force, and as many acts of terrorism have highlighted, no amount of physical security is undefeatable. And if it is, you stab someone standing outside of the wall.

And if it's to keep migrants out, there are many use cases to how effective it is or isn't at the scale of a country. At the scale of the city, considering you need to interact with the outside world (where there's farms and factories, i.e. where your goods and services come from), it's going to be a lot less effective.

• "The US never intended to invade." Of course we did. Jan 6 at 7:24
• @RonJohn Not after Okinawa. Not when they could just bomb the country into submission virtually unopposed. Jan 6 at 7:31
• There was a strong faction which still wanted to fight for the God Emperor even after being nuked twice. Jan 6 at 14:23
• @RonJohn The point of the analogy is that Japan is the city, the coastline and all its defences are a wall, and the Americans simply flew over like it wasn't there. Without the capacity to strike back at the airfields from which US planes took off, Japan's static defence were literally meaningless. And any fortified city today would suffer a similar fate, no matter if some in the leadership are prepared to sacrifice the whole population to defend the city from an invasion that's never coming. Jan 6 at 14:47
• Many B-29 bombers were shot down over Japan. Jan 7 at 20:17

# COVID-32: This time it's 95% lethal.

Nuff said, really. If you'd like more, Fortress WA may still be holding out somewhat against Omicron, and China may keep it out, but if you absolutely positively don't want to all die of a deadly disease, walls at the city level might be your better option.

• To keep potentially diseased people in, or out? Jan 6 at 19:57

The only way to get through your wall into the city is via the handful of carefully planned and well-defended gates. These serve as natural choke points that make it easier to defend against a ground assault. It also makes it far more difficult for spies, smugglers, or enemy sympathizers to sneak into your city.

You can even build the gates such that they allow foot traffic but not vehicle traffic (hedgehogs, bollards, or similar). You said that militaries no longer use walls of infantry, so a ground assault would make heavy use of wheeled vehicles, tanks, etc. None of these can get through your gates, so an attacker would have to try to punch a vehicle-sized hole in your wall (giving you plenty of time to counterattack from the high ground) or leave the safety of their armored vehicles and charge through the gates on foot (which you could defend against using a much smaller force).

This is similar to why modern military bases or prisons have reinforced fencing, sometimes in multiple layers. In a lot of cases it's just a chain-link fence with delusions of grandeur. An attacker could destroy it if they wanted to. However, they serve as a speed bump that requires that attacker to place themselves in a vulnerable, easily-detectable position for an extended period of time. A relatively small patrol force inside the base can defeat the attackers (or at least call for reinforcements) before the attacker has time to clear the obstacle. Surprise attacks become difficult and costly, requiring you to smash through a gate and land yourself in the middle of a kill zone.

In ancient times, walls were near-impervious obstacles. That's not practical thanks to modern weapons, but walls are still useful as a means to stall an oncoming blitz, force the attacker to waste resources, give the defender time to organize, and give some degree of control over where the fight happens.

Not On Earth

Your city is a habitat on a planet that dont have a naturally survivable atmosphere, so a barrier of either metal, glass, or even some kind of energy shield (you didn't specify which part of 21st century, we still got 80 year ahead of us) is necessary to contain oxygen and shield cosmos radiation. In this case, you can even have some kind of scene that resembles the old seige warfare--day long stalemate, promise of no looting to threats of massacre, cutting off supplies, the final breakthrough lead by the forlorn hopes, and then the looting in a completely dead city--because the oxygens are gone, everyone inside and exposed--not in shelter--is dead, and atrocity to those survived in the shelters.

There is an big wall around an entire country in our current world 2022. It is a MASSIVE wall, but it's invisible. It's sole purpose is to keep citizens in and attackers out. It is not a wall in the classical sense, but it essentially functions as a wall and that makes it a wall.

Of course I'm speaking of the great chinese wall. The digital one, the great firewall ( since you said you don't neccesarly mean stone walls)

Protection for citizens who might wander into defensive zones.

Robotic drones attack anything that moves in certain geographic areas. The drones limit their attacks using a GPS equivalent, but any hapless citizen who wanders into a "free attack" territory meets a bad end.

Inhabited areas surround themselves with walls not to keep anything out, but to make sure no citizens accidentally take a wrong turn and leave a safe zone.

• But... then you'd put up fences, not walls. Jan 6 at 7:22

Insurgents using snipers.

https://en.wikipedia.org/wiki/Sniper_Alley

The wall doesn't even need to be bulletproof, so long as the snipers can't see their targets they can't shoot.

defense

If the wall is particularly thick, it could be used as a platform for placing defensive weapons onto for a better line of sight against incoming missiles, bombs, aircraft, and whatever other threats that a wall doesn't counter. Put a large amount of CIWS guns along the wall and you could have decent protection against air targets. You could also mount large fortress guns for attacking ground targets at exceptional ranges, kind of like the German flak towers used in WW2 (though those were meant mostly for attacking enemy aircraft flying overhead anyway) They could also have an internal area for housing soldiers and equipment, as well as housing civilians temporarily in case of a bombing raid or something, though you would have to be careful with ammunition. One guy not reading the "no smoking" sign right outside the ammo stockpile room and now you're missing a chunk of your big wall.

Another thing, if were talking about near future tech, Laser anti munition system or LAMS. A wall is pretty big, perfect for having a place to charge up a giant laser ready to melt incoming projectiles.

morale reasons

A giant wall would raise people's spirits hiding behind the wall and lower their spirits outside of it. To the people living in the city, it would be "we are safe, we are protected from the enemy by this giant wall" and to the enemy its "man we have to assault this huge wall covered in guns and swarming with soldiers" Morale is important in siege warfare, even though there aren't really sieges anymore.

conclusion

for a wall to not only be viable but also for it to make any sense it would have to be VERY well defended from both air and ground targets and have to be VERY sturdy. it would only exist for siege warfare like when cannons were becoming tools that could crack castles wide open. Essentially, "we know that given enough time and enough pressure, we will lose this siege if we don't have any reinforcements, but how long is the enemy willing to sit here and how much are they willing to give up taking this city?"

I'm not certain about the conditions which might make building walls around cities necessary or desirable, but I can say that with modern conditions of relative wealth and ease of construction compared to premodern societies building walls around cities would be comparatively easy.

I'm not certain that modern people would be okay with gates where every road crosses the wall and the resulting delays in traffic if each vehicle has to stop at the gate for a check. Of course many old time cities left the gates open all day and let anyone go in or out during the day, and only closed the gates at night. That would be far more convient for modern people than stopping every vehicle for some sort of check as in an international border checking point.

European cities and towns and many villages usually had walls. If a city expanded or contracted its area, new walls were often built encloser larger or smaller areas.

In the USA and many other modern countries, cities have large suburbs which constantly increase and sprad out. City walls which included surburban areas would have to constantly be be expanded.

But if a sity is built with many buildings which are say, a hundred stories tall and a mile wide each, with people living on each floor of each building, or if cities are built with only skyscaper apartment buildings and no vast suburbs of single family homes, the inhabited areas of cities could be much smaller than the sprawling automobile based cities and it would be much more practical to build walls around such cities.

But anyway, building walls around cities would be practical if desired. Premodern Chinese cities were filled with houndreds and thousands of residential compounds, each with a wall around it. And sometimes each neighborhood in a large Chinese city had a wall around it. And the entire Chinse city usually had a wall around it.

And of course the country of China often had a wall around a large part of its permimeter. The Great Wall(s) of China blocked the northern border. I don't know how many thousands of kilometers or miles the Great Wall stretched at any one time, because entirely new great walls were built from time to timeby different governments when the border was in different locations.

So I don't now whether statements about the total length of the Great Wall include the total lengths of walls built and maintained at different times over two thousand years, or only the total length of, for example, the Ming Dynasty walls.

Anyway, ancient and medieval and early modern China had countles thousands of walled household compounds in the country and in cities, and coultless walls within and around cities, and often the most recent version ofthe Great Wall. It was a country with countless thousands of kilometers or miles of walls in total.

If all the other walls in China disappeared, or were never built in the first place, and the only walls that were built and maintained were the big walls around the hundreds of Chinese cities, building and maintaining those walls would have been a lot less work than building and maintaining all the walls which actually did exist in China.

Benin is the name of a country in west Africa. Benin city is in the neighboring country of Nigeria, just to confuse people. And one thing which Benin City is famous for is the Walls of Benin.

The Walls of Benin are a series of earthworks made up of banks and ditches, called Iya in the Edo language, in the area around present-day Benin City, the capital of present-day Edo, Nigeria. They consist of 15 km (9.3 mi) of city iya and an estimated 16,000 kilometres (9,900 miles) of rural iya in the area around Benin.1 The 'walls' of Benin City and surrounding areas were described as "the world's largest earthworks carried out prior to the mechanical era" by the Guinness book of Records.2 Some estimates suggest that the walls of Benin may have been constructed between the thirteenth and mid-fifteenth century CE3 and others suggest that the walls of Benin (in the Esan region) may have been constructed during the first millennium CE.3

The walls were built of a ditch and dike structure; the ditch dug to form an inner moat with the excavated earth used to form the exterior rampart.

https://en.wikipedia.org/wiki/Walls_of_Benin

So if the rural walls outside of Benin city total 16,000 kilometers or 9,900 miles, and were a single wall, they could make a square 4,000 kilometers by 4,000 kilometers, or 2,475 miles by 2,475 miles. But no doubt they are a group of many hundreds or thousands of much smaller enclosures, many of them probably connected.

I note that in Europe many "dykes" were built, which were defensive or boundry earthworks with earthern ditches and walls, similar to the Niegerian lya, except that the ditch was usually on th eouter side and the earthen wall on the inner side.

I note that Schleswig-Holstein in Germany has a defensive dyke called the Danevirke built over many centuries to defend Denmark from invasion from the south. The Danevirke was last used from military purposes during the Second Schlesvig-Holstein War in 1864.

Thus I suspect that European type dykes or Nigerian style lya could still be used for some military or police purposes in the 21st century.

I also note that walls and fences have often been used to keep wild animals or livestock inside or outside specified areas.

One form of livestock containing wall is a ha ha.

A ha-ha (French: hâ-hâ or saut de loup) is a recessed landscape design element that creates a vertical barrier (particularly on one side) while preserving an uninterrupted view of the landscape beyond from the other side.

The design can include a turfed incline that slopes downward to a sharply vertical face (typically a masonry retaining wall). Ha-has are used in landscape design to prevent access to a garden by, for example, grazing livestock, without obstructing views. In security design, the element is used to deter vehicular access to a site while minimizing visual obstruction.

https://en.wikipedia.org/wiki/Ha-ha

In many parts of Africa and South Asia, some farms and vilages have various forms of anti elephant ditches, walls, or fences to keep elephant herds from raiding the crops.

Australia is famous for rabbit proof fences.

The State Barrier Fence of Western Australia,1 formerly known as the Rabbit Proof Fence, the State Vermin Fence, and the Emu Fence, is a pest-exclusion fence constructed between 1901 and 1907 to keep rabbits and other agricultural pests, from the east, out of Western Australian pastoral areas.2

There are three fences in Western Australia: the original No. 1 Fence crosses the state from north to south, No. 2 Fence is smaller and further west, and No. 3 Fence is smaller still and runs east–west. The fences took six years to build. When completed in 1907, the rabbit-proof fence (including all three fences) stretched 2,023 miles (3,256 km). The cost to build each kilometre of fence at the time was about $$250 (equivalent to$$18,906 in 2018).3

When it was completed in 1907, the 1,139-mile (1,833 km) No. 1 Fence was the longest unbroken fence in the world.4

https://en.wikipedia.org/wiki/Rabbit-proof_fence

The Darling Downs–Moreton Rabbit Board fence is a pest-exclusion fence constructed between 1893 and 1997 to keep rabbits out of farming areas in Queensland, Australia. It is managed by the Darling Downs–Moreton Rabbit Board1 and is often referred to as "The Rabbit Fence" or "Rabbit Board Fence".[2][failed verification]

As of 2021 the fence has been expanded to 555km of rabbit-proof fence running from Mt Gipps to Goombi.1

https://en.wikipedia.org/wiki/Darling_Downs%E2%80%93Moreton_Rabbit_Board_fence

The Dingo Fence or Dog Fence is a pest-exclusion fence that was built in Australia during the 1880s and finished in 1885, to keep dingoes out of the relatively fertile south-east part of the continent (where they had largely been exterminated) and protect the sheep flocks of southern Queensland. It is one of the longest structures in the world. It stretches 5,614 kilometres (3,488 mi)1 from Jimbour on the Darling Downs near Dalby through thousands of kilometres of arid land ending west of Eyre peninsula on cliffs of the Nullarbor Plain2 above the Great Australian Bight3 near Nundroo.4

https://en.wikipedia.org/wiki/Dingo_Fence

There are also barriers built for enforcing laws.

The Inland Customs Line, incorporating the Great Hedge of India (or Indian Salt Hedge1), was a customs barrier built by the British colonial rulers of India to prevent smuggling of salt from coastal regions in order to avoid the substantial salt tax.

The line was gradually expanded as more territory was brought under British control until it covered more than 2,500 miles (4,000 km), often running alongside rivers and other natural barriers. It ran from the Punjab in the northwest to the princely state of Orissa, near the Bay of Bengal, in the southeast. The line was initially made of dead, thorny material such as the Indian plum but eventually evolved into a living hedge that grew up to 12 feet (3.7 m) high and was compared to the Great Wall of China. The Inland Customs Department employed customs officers, jemadars and men to patrol the line and apprehend smugglers, reaching a peak of more than 14,000 staff in 1872.

The line and hedge were abandoned in 1879 when the British seized control of the Sambhar Salt Lake in Rajasthan and applied tax at the point of manufacture.

https://en.wikipedia.org/wiki/Inland_Customs_Line

So I can imagine that even in modern times some sort of ditches, or dykes, or walls, or fences could be built around cities to keep people or animals in or out.

Such defenses would not be very good a stopping or slowing down invasions by major military forces, but could have some degree of police or military function.

• Eight walls of text just for two sentences at the very end which answer the question??? Jan 6 at 7:21