Owing the regions occupation by successive tribes of Celts, Romans and Muslims, it is likely that the territory of Campo Maior has been settled during the pre-historic epochs. The land of Campo Maior was definitively conquered from the
Moors by the forces of
Kingdom of León in 1230. Eventually, the castle was conquered by the Portuguese in 1295-1296, and integrated into the national territory in 1297, under the
Treaty of Alcanizes. In order to maintain the peace between Spain and Portugal, King
Denis ordered the reconstruction of the fortress in 1310, oriented toward his Iberian rivals. These fortifications were extended and rehabilitation during the 15th and 16th century completed, during the reigns of his successors
John and
Manuel, designed by
Duarte d'Armas.
Kingdom Around 1640, following the
Portuguese Restoration War, King
John IV established a Counsel of War that formed their territory into military provinces: Minho, Trás-os-Montes, Beira, Estremadura, Alentejo and Algarve. Therefore, following the decision of John IV, work began in 1645 under the supervision of João Cosmander to reconstruct the bulwarks. Between 17th and 18th century the fortification was adapted for the time, obtaining the bulwarks and secondary walls, in addition to the installation of permanent military storehouses, stables and barracks. After 1644, many of the reconstruction of the fortress was handled by Nicolau de Langres. A document, dated 14 May 1647, identified Langres as the military engineer of the project, while requesting material for the construction of military square, in addition to the arms necessary to protect the castle and its surrounding territory. In 1662, Luís Serrão Pimentel continued work on the walls. On 22 May 1680,
D. Peter, acting as regent, ordered Mateus do Couto, D. Diogo Pardo and António Rodrigues to Campo Maior, in order to verify the work being done on the citadel, under the plans of Luís Serrão Pimentel. During the
Spanish War of Succession, in 1712, the square was besieged by Spanish forces and defended in the main square. In 1732, an explosion in powder magazine (caused by thunderstorms) resulted in the destruction of the castle and surrounding walls of the old town around 3:00 in the morning; the space was totally levelled, and many of the homes around the walls were destroyed. At the time of the explosion, the magazine held of gunpowder and 5000 munitions; the violent explosion resulted in a fire that, in addition to the direct deaths, consumed almost half of the town's homes. The powder magazine was reconstructed by order of
John V of Portugal in 1735, under the meticulous care of Manuel de Azevedo Fortes. On 2 July 1736, Diogo Lopes de Sepúlveda was awarded the commission to the post of Sergeant-Major, as part of his efforts in reconstructing the square after these events. But, in 1762, Spanish forces, once again, invaded the territory (during the
Seven Years' War) and met the Portuguese in Campo Maior.
Peninsular wars During the
Peninsular War, during the
Battle of the Oranges (), Portuguese forces capitulated in 1810. After a small victory, these forces recapitulated in 1811.
20th century On 18 March 1911, the structure was classified as a national monument by Decree. In the first half of the 1940s, the
Direcção-Geral dos Edifícios e Monumentos Nacionais (DGEMN) began works to restore the group of structures. A second phase of construction was begun in the 1960s, and extended into the 1970s, marked by interventions in the castle walls and the Chapel of Nossa Senhora dos Aflitos. A third phase of reconstruction began in the latter part of the 1980s, when the castle and walls repaired, just before the castle became the responsibility of the
Instituto Português do Património Arquitectónico (IPPAR), on 1 June 1992, Decree-law 106F/92. Owing to bad weather in 2010, the castle walls were partially destroyed. ==Architecture==