The purpose of a medieval castle dungeon was to detain prisoners. The dungeons were often dark, damp, and dirty, and were not meant to be comfortable places. Prisoners were usually kept in chains or locked in cages, and they were often subjected to torture.