The Spanish Monarchy: perpetual administrator of the Maestrazgo (1587 – 1808)
Felipe II took up the state of Master of Montesa as perpetual administrator in 1587: the Order of Montesa was under state control. With its inclusion in the Crown, the supreme authority in the territory was a lieutenant, residing at the Palace of the Masters. Despite that, the Montesian institutions moved progressively to Valencia and Madrid.
Throughout the 17th century, the population suffered several climatic calamities, epidemics and wars. A flood devastated the harvests and caused a great famine in November 1617. The drought brought about the loss of the wheat harvest in 1628, 1630 and 1631 and, for that reason, a lot of people left the town. A thousand people died of plague between 1649 and 1652. Moreover, Sant Mateu was besieged by a French army in 1649 in the context of the Guerra dels Segadors (conflict which ended with the separation of Catalonia in the Pyrenees). Finally, new rains and floods destroyed 120 houses in the urban area in 1672.
During the War of Spanish Succession, the English colonel John Jones arrived before the town walls and deployed his army, about 2,500 soldiers. The town was exhausted due to the progression of a chaotic 17th century and was neglected by the lieutenant of Montesa, Jorge de la Figuera, which suddenly escaped from Sant Mateu. For this reason, the town decided to not offer resistance and was in favour of the House of Habsburg, swearing allegiance to the archduke Carlos de Austria.
Nevertheless, on 28th December 1705, Sant Mateu suffered another siege when a French army, commanded by the marquis of Insterseldt, arrived at the town. Thereby, a bloody and incessant exchange of fire between both sides started and went on until the 7th January 1706, when some reinforcements commanded by the count of Peterborough arrived and caused that the Bourbon troops took flight.
On April 1707, the Bourbon victory in the Battle of Almansa put an end to the War of Spanish Succession into Valencian territory. Years later, with the Nueva Planta decrees, Felipe V abolished the Valencian jurisdiction, embodied in its furs (regional code of laws), and implemented the Castilian institutions. In the middle of May, the duke of Berwick arrived at Sant Mateu with a big Bourbon army which started to destroy the town walls as a punishment. Only two defensive sections were still standing after 1707: a wall which encircled the Convent of the Augustinian Nuns and a smaller one which bordered on the military hospital (currently, Music Band House and Public Library).
Although the war caused a lot of deaths and exiles (from 346 dwellings in 1703 to 246 dwellings in 1713), throughout the 18th century the population increased considerably reaching the 691 dwellings in 1793. This population growth continued throughout all 19th century.