Moats were deep and wide trenches, usually filled with water, to provide a barrier against attack upon castle ramparts or other fortifications. Often streams were diverted in the Middle Ages to fill the ditch. Moats required upkeep. They had to be dredged for debris which could potentially form a traversible bridge from one side to another.
Bridges spanned across moats in the Middle Ages. At first they were only simple wooden bridges that could easily be destroyed if an enemy was about to breach the fortifications. Later flying bridges and drawbridges were used for moat spans.