The Poles built the barbican fearing an attack by the Ottoman Empire after the defeat of King John I Albert at the Battle of the Cosmin Forest.