In 1700, Charles II, King of Spain died without leaving an heir. In his will he gave the crown to the French Prince of Anjou. Philip’s grandfather, Louis XIV of France proclaimed him king and declared that France and Spain would be united.
This upset the balance of power in Europe and a Grand Alliance of England (Great Britain did not exist until 1707 after unification with Scotland), Holland, Austria and Prussia aimed to put the Hapsburg Archduke Charles of Austria on the Spanish throne as Charles III instead of Philip. Inevitably war broke out and battles were fought in Spain, Italy, Germany, Holland and at sea. The English general the Duke of Marlborough, one of the Churchill family, and Prince Eugene commanded the forces of the Grand Alliance.
In 1711, Emperor Joseph I of Austria died. His successor, who would also become Emperor of the Holy Roman Empire was Archduke Charles of Austria. It was immediately obvious that the balance of power would be even more prejudiced if Austria and Spain were ruled by the same person, Charles. This threat enabled Louis XIV, who had suffered a number of defeats in battle, to obtain favourable terms in the Treaty of Utrecht (1713). His grandson, Philip, became King of Spain on condition that France and Spain would never be united. In return Great Britain received Gibraltar, Newfoundland, Nova Scotia, the Hudson Bay Territories and the monopoly of the slave trade with Latin America. Charles at first refused to sign the treaty but a year later recognised he could never defeat the new alliance and signed the Peace of Rastatt in 1714.
In June 1704 the combined fleets failed in an attempt to take Barcelona. Rooke was put under pressure to again try to take Cadiz but decided instead to take a small fortified Spanish town at the southwest tip of the Iberian Peninsula, Gibraltar.
After a heavy bombardment the English and Dutch marines and sailors invaded the town. Don Diego de Salinas, governor of Gibraltar, surrendered on the 3rd August 1704. Three days later Prince George entered the town with Austrian and Spanish troops loyal to the Hapsburgs in the name of George III.
The Treaty of Utrecht was a series of individual peace treaties signed by representatives of the members of the Grand Alliance on one side and France and Spain on the other, each trying to gain, or retain, maximum territory and trading privileges as possible.
The part of the Treaty of Utrecht that concerns us is that part dealing with Gibraltar, Article 10. It is reproduced below in full.
The Catholic King does hereby, for himself, his heirs and successors, yield to the Crown of Great Britain the full and entire propriety of the town and castle of Gibraltar, together with the port, fortifications, and forts thereunto belonging; and he gives up the said propriety to be held and enjoyed absolutely with all manner of right for ever, without any exception or impediment whatsoever.
But that abuses and frauds may be avoided by importing any kind of goods, the Catholic King wills, and takes it to be understood, that the above-named propriety be yielded to Great Britain without any territorial jurisdiction and without any open communication by land with the country round about.
Yet whereas the communication by sea with the coast of Spain may not at all times be safe or open, and thereby it may happen that the garrison and other inhabitants of Gibraltar may be brought to great straits; and as it is the intention of the Catholic King, only that fraudulent importations of goods should, as is above said, be hindered by an inland communications. it is therefore provided that in such cases it may be lawful to purchase, for ready money, in the neighbouring territories of Spain, provisions and other things necessary for the use of the garrison, the inhabitants, and the ships which lie in the harbour.
But if any goods be found imported by Gibraltar, either by way of barter for purchasing provisions, or under any other pretence, the same shall be confiscated, and complaint being made thereof, those persons who have acted contrary to the faith of this treaty, shall be severely punished.
And Her Britannic Majesty, at the request of the Catholic King, does consent and agree, that no leave shall be given under any pretence whatsoever, either to Jews or Moors, to reside or have their dwellings in the said town of Gibraltar; and that no refuge or shelter shall be allowed to any Moorish ships of war in the harbour of the said town, whereby the communication between Spain and Ceuta may be obstructed, or the coasts of Spain be infested by the excursions of the Moors.
But whereas treaties of friendship and a liberty and intercourse of commerce are between the British and certain territories situated on the coast of Africa, it is always to be understood, that the British subjects cannot refuse the Moors and their ships entry into the port of Gibraltar purely upon the account of merchandising. Her Majesty the Queen of Great Britain does further promise, that the free exercise of their religion shall be indulged to the Roman Catholic inhabitants of the aforesaid town.
And in case it shall hereafter seem meet to the Crown of Great Britain to grant, sell or by any means to alienate therefrom the propriety of the said town of Gibraltar, it is hereby agreed and concluded that the preference of having the sale shall always be given to the Crown of Spain before any others.
The signing of the Treaty of Utrecht was not however the end of the war. It rumbled on with France remaining at war with Emperor Charles VI and the Holy Roman Empire itself until the Treaty of Rastatt in March 1714 ended the war between France and Austria and the Treaty of Baden in September the same year ended the hostilities between France and the Holy Roman Empire. Spain and Portugal remained formally at war until the Treaty of Madrid in 1715 whilst peace between Spain and Emperor Charles VI came only in 1720 at the signing of the Treaty of the Hague.