Both France and Spain began by supplying funding and arms to the American rebels, and drew up a strategy to intervene on the American side against Britain. France entered the war in October 1778 and on 12 April 1779 signed the Treaty of Aranjuez with Spain based on its Third Pacte de Famille between the Bourbon kings, wherein they agreed to aid one another in recovering lost territory from Britain. Spain then declared war on Britain on 16 June and became a formal co-belligerent with the United States Congress. The first war aim for Spain at Aranjuez was to secure Gibraltar, and the agreement with France was not to make peace or agree to a truce until that place was recovered. With the British occupied with the war in America, their base at Gibraltar was vulnerable, and Spain expected its capture to be a straightforward opening to the war, to be followed by a Franco-Spanish invasion of Great Britain that could be used as a in negotiations to recover the lost colonies.