Borba Castle was erected during the reign of King Afonso II, specifically to protect the town and later the borders of the Alentejo.