States with a Treaty of Alliance in October 1778. On 12 April 1779 France 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 bargaining chip in negotiations to recover the lost colonies. Opposing forces The Spanish blockade was to be directed by Martín Álvarez de Sotomayor. Spanish ground forces were composed of 16 infantry battalions, which included the Royal Guards and the Walloon Guards, along with artillery and 12 squadrons of cavalry. This yielded a total of about 14,000 men. The artillery was commanded by Rudesindo Tilly, while the cavalry and the French dragoons were headed by the Marquis of Arellano. Antonio Barceló commanded the maritime forces responsible for blockading the bay. He established his base in Algeciras, with a fleet of several xebecs and gunboats. French involvement was limited, but in 1781 the first of them arrived in numbers with the Régiment de Besançon (Half Company of artillery). A fleet of 11 ships of the line and two frigates were placed in the Gulf of Cadiz under the command of Luis de Córdova y Córdova to block the passage of British reinforcements. The British garrison in 1778 consisted of 5,382 soldiers under General Eliott as Governor-General. All the defences were strengthened. The main physical task facing Eliott was an extensive building programme of new fortifications for Gibraltar, as set out in a report by a commission that had examined the state of the Rock's defences in the early 1770s. The most prominent new work was the King's Bastion designed by Sir William Green and built by the Soldier Artificer Company on the main waterfront of the town in Gibraltar. The King's Bastion comprised a stone battery holding 26 heavy guns and mortars,