A defensive wall is a fortification used to protect a city, town or other settlement from potential aggressors. In ancient to modern times, they were used to enclose settlements. Generally, these are referred to as city walls or town walls, although there were also walls, such as the Great Wall of China, Walls of Benin, Hadrian's Wall, and the metaphorical Atlantic Wall, which extended far beyond the borders of a city and were used to enclose regions or mark territorial boundaries. Beyond their defensive utility, many walls also had important symbolic functions – representing the status and independence of the communities they embraced.
Existing ancient walls are almost always masonry structures, although brick and timber-built variants are also known. Depending on the topography of the area surrounding the city or the settlement the wall is intended to protect, elements of the terrain (e.g. rivers or coastlines) may be incorporated in order to make the wall more effective.
Walls may only be crossed by entering the appropriate city gate and are often supplemented with towers. The practice of building these massive walls, though having its origins in prehistory, was refined during the rise of city-states, and energetic wall-building continued into the medieval period and beyond in certain parts of Europe.
Simpler defensive walls of earth or stone, thrown up around hillforts, ringworks, early castles and the like, tend to be referred to as ramparts.(Wikipedia)
"City walls 2"
"Dubrovnik from City Walls"