At the time of the Christian reconquest of the peninsula, was conquered from the Moors by Fernando Magno (1063); it's assumed that there was an existing fort at the time.
D. Afonso Henriques (1112-1185) found the village deserted. To encourage its repopulation and defense, gives it charters, ensuring privileges not only to those that by royal initiative there were established on occasion, but to all who did so in the future.
In the transition to the thirteenth century, King D. Sancho I (1185-1211) continued the work of rebuilding the castle, enlarging its walls, that began to involve the village. His son and successor, D. Afonso II (1211-1223), confirmed its charter (1217).
In the crisis of 1383-1385, Marialva and its castle, took the party of the Master of Avis.
In the fifteenth century, D. Afonso V (1438-1481) granted it the title of county, and D. Vasco Fernandes Coutinho received the title of Count of Marialva (1440).
At the time of the Restoration of Portuguese independence, the old castle suffered a new campaign of construction works, when a bulwark is addorsed to the walls. During this period, D. Afonso VI (1656-1667) raised to the status of the village Marquessate, whose title was awarded to António Luís de Meneses, appointed Count of Cantanhede, in recognition of services rendered in the War of Restoration, particularly in Elvas and in Montes Claros.
It was only in the late 20th century, that this architectonic set, captured the public interest, having been declared as a National Monument on 12 September 1978. The formalization of a protocol between the IPCC and the Meda City Hall (1986), made possible the development of recovery and improvement works in monument.
-- Source