Treaty of the Pyrenees
The fort was captured by the French in 1642, and remained French since the Treaty of the Pyrenees.