Medieval moats served not only the purpose of being a physical barrier but when water-filled were also able to prevent enemies from tunneling and undermining a wall, by saturating the ground, making tunneling very difficult.