Joseph de Margarit was a Catalan nobleman.  Baron of Aguilar, Count of Osona, Viscount of Cabrera, Lord of the Castles of the Baronies of Vallespinosa, Biure, Preixens, Santa Perpetua de Gaia, Llacuna and Castell d'Empordá, Governor of Catalonia during the war of the Segadors, Lieutenant of the militias of the Generalitat, fervent opponent to his cousin the viceroy of Catalonia Dalmau III de Queralt Count of Santa Coloma, and Felipe IV,  He was ambassador of the Generalitat in the court of Luis XIII of France, where he met with the Cardinal Mazarino offering loyalty to the Gallic crown, after the signature of the treaty of the Pyrenees (1659) between the Hispanic and French monarchies, Felipe IV confiscated all the properties to the Margarit, together with his children he moved to Perpignan and later to the castle of Salses where he died at the age of 83 years.
 Louis XIV of France rewarded his loyalty by naming him Marquis of Aguilar, Baron of Brens and Lord of Tuis and Toluges.
When arriving to the throne of Spain, Felipe V grandson of Luis XIV of France pardoned the Margarit descendants, restoring their properties and noble titles.

 
