EU states have decided to move the HQ of their Atalanta anti-piracy mission from the UK to Spain and France due to Brexit.

The mission, which has fought piracy off the Horn of Africa for the past decade, will see its command moved from Northwood, in south-east England, to Rota, in south-west Spain, and to Brest, in western France, on 29 March next year, EU diplomats meeting in Brussels on 30 July agreed.

Student or retired? Then this plan is for you.

Its British chief, major general Charlie Stickland, will hand over his baton to a Spanish naval officer, vice admiral Antonio Martorell Lacave, on the same date.

The diplomats also agreed to extend its life by one more year, until 31 December 2020, and to set aside €11.8m for its operations.

The mission currently involves two ships - an Italian frigate called ITS Carlo Margottini and a Spanish patrol vessel called ESPS Meteoro - as well as a Spanish surveillance plane.

The Italian vessel is the mission's flagship and Italy had put in a bid to take over Atalanta instead of Spain.

Italy already hosts the command HQ for Operation Sophia, the EU's anti-migrant smuggling mission in the Mediterranean Sea.

Rome's argument was that it would make more sense to have one EU naval command as Europe prepares for deeper defence integration.

"Military logic calls for a unified command for both ongoing EU operations, Sophia and Atalanta," admiral Luigi Binelli Mantelli, Italy's former military chief, told EUobserver in April.

"There are, however, signs of political games in perfect incoherence with the tenets of that logic," he said.

The "political games" referred to EU efforts to share out Britain's European assets, such as its EU banking and medicines agencies, as well as its satellite and medical test laboratories, evenly among member states.

The fact that anti-EU parties - the hard-right League and the populist 5 Star Movement - took power in Rome in May might not have helped its pitch, but the EU statement made no mention of that on Monday.

"The relocation and change in command are required due to the UK's decision to withdraw from the EU," it said.

The banking agency, the EBA, went to Paris, and the medical one, the EMA, went to Amsterdam.

Spain won Atalanta after putting on a show, called Operation Sarunia, for EU diplomats in April, which involved flying them from Brussels to Rota to watch Spanish special forces confront make-pretend pirates on a make-pretend fishing boat out at sea.