The Treaty of the Pyrenees or Peace of the Pyrenees was signed on November 7th 1659 by Felipe IV of Castile and III of Aragon, Luis Méndez de Haro and Pedro Coloma for Castile and Louis XIV of France, Cardinal Mazarin and Hugues de Lionne for France on Pheasant Island in the River Bidasoa in the north of the Basque Country.
It officially put an end to the Thirty Years War and the consequences for Catalonia were the loss of the County of Rosselló and part of La Cerdanya to France.
Felipe IV negotiated the treaty without consulting the Corts Catalanes and, in fact, the decision was officially revealed until the Corts de Barcelona in 1702, although it was common knowledge from 1660 onwards as the ambassador of the Generalitat "sent congratulations for the good news of the peace between Spain and France".
The affected territories campaigned to go back to being Catalan for decades, and the Catalan authorities resisted the partition, which became effective in 1720.
Unlike Gibraltar and Menorca, which were ceded to England as a result of the Treaty of Utrecht in 1713, the Spanish government has never tried to recover the Catalan teritories ceded in the Treaty of the Pyrenees.
The only exception to this was when Franco apparently put pressure on Hitler to make Pétain return French Catalonia to Spain at their meeting in Hendaia on October 23rd 1940.