Image copyright Reuters Image caption The EU Naval taskforce's current headquarters are in London

The UK will lose command of the EU naval task force - set up to combat piracy off the coast of Somalia - as it exits the European Union.

The headquarters - currently in Northwood, north London - will move to Rota in Spain, with some operations heading to Brest, in France.

The European Council made the move "following the decision by the UK to withdraw from the EU".

The Ministry of Defence said it was a "natural consequence" of Brexit.

The BBC understands around 40 UK staff will be found jobs elsewhere.

The task force - known as EU Navfor - was set up in 2008.

The council has extended its mission until 2020, but will continue from its two new hubs from the spring of next year, led by Spanish Vice Admiral Anotnio Martorell Lacave.

Its current operational commander, Major General Charlie Stickland, said: "The transition is being planned with the utmost consideration to ensure it is smooth and seamless with continued cooperation and collaboration with all stakeholders throughout the region."

'A blow' to UK

BBC defence correspondent Jonathan Beale said the move was "not a surprise to the UK", which is due to leave the EU on 29 March 2019, but it is "still a blow".

He said the statement from EU Navfor left "no doubt" that the move was because of Brexit,

He added: "The government has signalled it is still willing to contribute to future EU defence and security operations.

"But this is a sign it won't be easy."

'Natural consequence'

The operation has the backing of 19 EU nations and two partner nations.

Member states have contributed warships to protect shipping and to escort World Food Programme vessels providing aid to Somalia.

A spokesman from the Ministry of Defence said the leadership of the operation "has always been and will continue to be a matter for the European Union".

He added: "The relocation of its headquarters away from Northwood, and a change in the nationality of the mission's commander, are natural consequences of the UK's decision to leave the EU.

"Yet while certain details of our relationship with the EU are changing, our unwavering commitment to European security does not."