In 1494 the armies of the French king, Charles VIII, invaded Italy to capture the kingdom of Naples. They swept through the country and bombarded and destroyed many castles. This invasion signaled the end of the castle as a stronghold of defense. For centuries it had been the dominant fortification in Western Europe for the defense of kings, nobility, and townspeople. Ancient cities were often walled to keep out invaders, and within the walls there was usually a citadel, a strongly built fortification occupying the highest or militarily most advantageous position. A castle is much like such a walled city and its citadel contracted into a smaller space. Castles were basically fortified locations. The word itself comes from the Latin castellum. Up to the 6th century fortifications were primarily communities in which most of the population lived. But in the middle of the 6th century, the armies of the Byzantine Empire began to build strong forts as defensive positions.
For the next few centuries this castle building was confined to the Byzantine Empire, but later hordes of Islamic warriors who swept out of Arabia to conquer the Middle East, North Africa, and much Byzantine territory also started building such forts. Western Europe, in the depths of the Dark Ages from the 5th through the 9th century, had no such works. But late in the 9th century, as local lords and kings began to consolidate power, castle building began probably in France. Once begun, castle building spread rapidly to other areas. But it was not until the 12th and 13th centuries, after the Crusaders returned from their wars against Islam in Palestine, that castles as imposing as those of the Byzantine or Islamic empires were constructed in Europe. Many of the stone castles of the late Middle Ages still stand.