The Third Treaty of San Ildefonso ( short for the Preliminary and Secret Treaty between the French Republic and His Catholic Majesty the King of Spain , Concerning the Aggrandizement of His Royal Highness the Infant Duke of Parma in Italy and the Retrocession of Louisiana ) was a treaty between France and Spain . In it , Spain gave the territory of Louisiana to France . The Third Treaty of San Ildefonso ( formally titled the Preliminary and Secret Treaty between the French Republic and His Catholic Majesty the King of Spain , Concerning the Aggrandizement of His Royal Highness the Infant Duke of Parma in Italy and the Retrocession of Louisiana ) was a secretly negotiated treaty between France and Spain in which Spain returned the colonial territory of Louisiana to France .