Brexit has put the Rock back in the news, with Spain being awarded a veto over future EU deals on Gibraltar – effectively giving the country its strongest hand in the territory for three centuries. So what could come of all this?

Why do Spain and Britain care about Gibraltar?

Visitors to Gibraltar, a tiny British territory that still boasts red phone boxes and greasy fish-and-chip shops, might feel bemused by the recent fuss over its future. Outwardly, it is an insignificant piece of Europe that juts out from the southern end of the Iberian peninsula into the mouth of the Mediterranean Sea. Gibraltar is mostly made up of a barren, 1,400ft-high limestone rock and a flat, concreted-over isthmus that connects it to Spain. It is famous for its colony of barbary apes and the magnificent views of the coast of Morocco, in North Africa, which lies just nine miles away, across a sparkling sea.

This harsh and dramatic topography means that Gibraltar’s value comes exclusively from its position. Whoever controls it can also exercise pretty thorough control of shipping going into and out of the Mediterranean from the Atlantic. You can, for example, sail from Gibraltar to the Syrian port of Latakia or to Sebastopol, the main Black Sea port in Crimea and a key Russian naval base. Anyone wanting to sail from those places into the Atlantic without taking a very long trip through the Suez canal and around Africa must pass in front of the The Rock (as it is otherwise known). That is why, for many years, the British valued it as a major naval outpost. But the Royal Navy now has only a small presence, and a massive Nato base at nearby Rota – which is home to several US navy destroyers – is a far more potent military presence. Britain and Spain, of course, are Nato allies.

How did it become British?

The seizure of Gibraltar by a joint Dutch-British force in 1704 came as Britain took over from Spain as Europe’s strongest imperial nation. Possession was sealed in the Treaty of Utrecht in 1713. Gibraltar had only belonged to Spain – or at least Christian Spain – for 250 years before that, so it has spent more time under the British flag than the Spanish one. Previously, it was in the hands of Islamic kingdoms for seven centuries.

Spain has not given up claiming sovereignty over the Rock, however. In 1969, dictator General Franco closed the frontier entirely, turning a generation of Gibraltarians against Spain. It was not opened properly again until Spain began negotiating entry to the European Union in the 1980s. Regular squabbles are had over fishing rights, territorial waters, the airport and land access to Gibraltar – where some 4,000 local Spaniards work in a booming economy that is home to part of Europe’s online gambling industry. In 2002, a shared sovereignty deal was nearly reached, but both the conservative Spanish prime minister José María Aznar and the 30,000-strong population of Gibraltar – who voted 98% against – walked away from it.

What has changed?

In June 2016, British voters decided at a referendum to leave the European Union. Gibraltarians were also allowed to vote. Realising that departure from the EU would leave them exposed to Spanish demands for sovereignty, they voted 96% in favour of staying. But when the UK leaves, Gibraltar must leave, too. The EU has since awarded Spain a veto over any future EU deals with the Rock. This means, in effect, that leavers have given Spain its strongest hand in Gibraltar for three centuries. Some of those who campaigned for Brexit – ex-ministers including Norman Tebbit and Michael Howard, or newspapers including the Sun – are now indignant that Spain has won a veto. Comparisons have been made to the Falkland Islands, which Britain fought a war over in 1982. But some Gibraltarians fear they have been sold down the river by the same people who are now claiming to be so outraged by what is happening.

Is there a solution?

Yes, there are several. None include gunboats. One is for Gibraltar to remain entirely British, run all future EU deals past Spain and accept the risk of these being blocked – with potentially devastating effects on the local economy. Another is shared sovereignty. That would allow Gibraltarians to stay in the EU and enjoy joint British and Spanish nationality. They would remain EU citizens, with all the rights that come from that, while keeping their current institutions and legislation. But Spain would become a co-sovereign. Either way, British governments since Harold Wilson’s time have insisted that only a solution backed by the Gibraltarians themselves is acceptable.

So what about Spain? It also walked away from shared sovereignty in 2002. And, even while negotiating that, it made clear that it would never drop its claim to full sovereignty. Gibraltarians who remember both Franco and more recent episodes of Spanish bullying find that frightening. There are few signs of a strong opinion shift in Gibraltar towards shared sovereignty, not least because Spain has gone back into bully mode in recent days by slowing border traffic. Self-interest and a long charm offensive by Spain might eventually change that – otherwise Gibraltar will continue to face an uncertain future.