The fortress's origins date back to the 13th century, during the reign of King Afonso III, who ordered its construction. Over the centuries, the structure was adapted and reinforced. It gained particular importance in the 15th and 16th centuries, when the village of Vila Viçosa became an important center for the House of Bragança. The fortress witnessed key moments in Portuguese history, serving as a refuge and stronghold, particularly during the War of the Restoration in the 17th and 18th centuries, demonstrating its resilience and strategic value. The centerpiece of the fortress is the extensive wall that encloses the oldest part of the village.