Spain too was keen on having an outpost near the centre of the Mediterranean, and in 1603 Philip III of Spain succeeds in seizing the natural inlet of Longone (Porto Azzurro), and starts having a fortress built based on the drawings of Garcia di Toledo who used the Hanseatic port of Anversa as his model.
For almost 150 years the Spanish garrison was established there. In 1646, after conquering Piombino, three thousand infantrymen and three hundred horsemen landed in Elba and seized Rio, the fortress of Giogo, and then Longone; France too was keen to set up a stronghold and conquer Italy.
The Spaniards were outnumbered and had to surrender, although years later, lead by Don Juan, Philip IV's son, they did manage to get their 4 dominions back.
Pirate attacks however still contunued from the sea, so partly for this reason, and partly because they wanted to defend themselves from the French, the Spaniards decided to have another fortress built in the bay of Longone: Forte Focardo (1659). Standing opposite the fortress in Longone made it almost impossible to enter the bay. After the turbulence of what was happening more or less all over Europe, we get to the year 1708, when the Austrian troops, who in the meantime had allied with the Spaniards against the French, land in Rio, which was still under the Spaniards.
Unaware of this alliance, the Spaniards put up a fight, above all in Longone and Capoliveri for at least 4 months, then using several strategic manoeuvres finally managed to force the Germans to retreat. The Spaniard Pinel accused the locals of abetment and gave orders for the walls, that had up till then surrounded Capoliveri, to be destroyed; both the fortresses of Giogo and Marciana were damaged, as were several others, and due to complaints in Madrid on behalf of the Elbans, Pinel was cashiered.
In 1713 Cosimo III's heir Ferdinando died. Following the Grand Duke Gian Gastone's orders, the fortress of S.Giovanni Battista near Portoferraio is knocked down for fear of it falling into enemy hands and thus becoming a serious threat to Cosmopoli. In 1738, since Carlo Borbone had no male heirs, Gian Gastone's successor is the son of Elisabetta Farnense and Philip V of Spain; due to a political agreement Elba however is passed on to the German Francis of Asburgo.
Several years later his second son Pietro Leopoldo takes his place; in the beginning he wanted to hand Portoferraio over to the English, but then started to consider his dominion on Elba very important so not only did he have the lighthouse in Portoferraio built, he also made mercantile development easier.
In the summer of 1796, with the excuse of defending them from the French, the English are given permission by the Grand Duke governor to land in Elba; due to the fact that they outnumbered the population, as well as having better weapons, the island becomes a British stronghold.
The Grand Duke Ferdinand complained so much that in April 1797 the English had to leave the Island. In the meantime, one by one, France had sent the Italian rulers away; in 1799, despite strong opposition, Elba too became a French republic.