An escape tunnel is a form of secret passage used as part of an escape from siege or captivity. In the Middle Ages, such tunnels were usually constructed by the builders of castles or palaces who wished to have an escape route if their domains were under attack. Prisoners have also dug escape tunnels to flee captivity.