A castle moat was one of the most important fortifications used in the defence of a medieval castle. The moat evolved from a kind of defence used by the Normans in their early medieval motte-and-bailey castles.
The Normans built these castles by erecting a keep on a high mound of earth. A ditch then ran to the bottom of this hill-like structure.
This eventually evolved into a proper moat which was essentially a long, wide, and deep ditch running all around the periphery of castle walls. Different kinds of moats were constructed depending on the kind of defence that the castle owner conceived.
Making a castle moat was usually considered essential, particularly for castles that were vulnerable to attacks.
The most basic feature of a castle moat was the ditch. The ditch was dug all around the boundary walls of the castle. Typically, such a ditch could be as much around 12 feet wide and 30 feet deep for small castles. For larger castles, the ditches were exceptionally wide to often resembled veritable rivers.
In all cases, the purpose of the ditch was to put a defensive space between the castle boundaries and a potential attacker. Once the ditch had been dug, the castle defenders chose between using it as a dry defence or filling the ditch with water. As a dry defence, the ditch was set up with wooden stakes and other barriers.
Attackers then had to confront these sharp and dangerous stakes through the ditch which considerably slowed down their march. The other option was to fill up the ditch with water. This was usually possible for such castles which were situated near a water body such as a river.
Once the ditch was filled, any approaching enemy had to swim or wade through it, making it possible for defenders on castle walls to kill many of them as they did so.
The only reason why a castle moat was constructed around most medieval castles was that it formed a formidable defence against an attacking enemy.
The moat became popular at a time when there were certain ways of attacking a castle.
An enemy could either storm and scale the castle walls with ladders, force their way over the walls and thus gain entry. They could use siege engines to storm into the castle entrance. Or they could use tunneling to collapse a portion of the castle walls and thus breach an entry.
The moat was an excellent counter-measure in that it made all three of such tactics very difficult if not entirely impossible. With water all around a castle, tunnelling was essentially impossible and if any attempts were made, sufficient water was available to drown the attempts.
Similarly, carrying ladders over the ditch and erecting them against the castle walls was nearly impossible or made much harder by forcing the enemy to use barges which could be attacked from inside the castles walls.
Finally, the entrance of a moat-protected castle was usually protected by a drawbridge and compared to regular castle gatehouses, was a lot harder to breach.