The Treaty of Valençay was signed between the French Empire and the Spanish Crown on 11 December 1813. The agreement provided for the restoration of Ferdinand VII as King of Spain, who had been imprisoned in France, in the Château de Valençay, since his abdication in 1808.
That year, 1808, soon after the start of the Peninsular War, Napoleon occupied Spain. The French considered the occupation as bringing modern liberty to a people still governed by the Inquisition. Meanwhile, Ferdinand, the eldest surviving son of Charles IV of Spain, believed that the French troops were in Spain to support him after his frightened father had abdicated in his favour.
Napoleon Bonaparte had another plan. He was sure that the Spanish people would accept his brother Joseph as king while the rightful heir sat in a French prison.
However, the Spanish people hated Joseph Bonaparte, seeing him as a foreigner and an upstart, and they put up resistance, keen to change the situation. In August 1808, British troops under the command of Sir Arthur Wellesley (1st Duke of Wellington) landed in Portugal and sided with the Portuguese and the Spaniards against the French. The British government acknowledged Ferdinand VII as king of Spain on 14 January 1809.
However Napoleon only allowed Ferdinand to return to Spain in March 1814, after recognising him as king in Valençay the previous December.
During the war against the French a group of liberal Spaniards in Cadiz wrote the Constitution of 1812, which placed severe limitations on the power of the monarchy.
Therefore, a liberal monarchy was expected, but Ferdinand returned to the authoritarian rule of his father.
He abolished the Constitution of Cadiz, imposing the absolute power of the crown. Ferdinand's return to absolutism was supported by the church and wealthy landowners.
Empowered by the Spanish parliament, he attempted to rule as a despot. For the rest of his reign Ferdinand governed by force of arms.
Ferdinand VII ruled Spain till his death. The royalists called the king 'el Deseado' ('the desired one'). The liberals meanwhile, seeking freedom from absolute monarchy, gave him a nickname 'el Rey Felón' ('Felon King'). In March 1820, they finally forced the king to restore the Constitution of Cadiz.
The Treaty of Valençay also provided for an armistice between France and Spain, although this was never ratified by the Spanish parliament. In addition, Ferdinand VII had apparently given a secret oath to turn over the Spanish army to Napoleon if the British and the Portuguese continued to attack France.