When Spain's King Felipe VI and his 14-year-old daughter arrived at Barcelona airport last weekend, hackers issued a message about their whereabouts, warning protesters of three possible exits.

The directive was sent by the computer hacker group Anonymous in Catalonia to 255,000 of its subscribers on the popular encrypted messaging app Telegram to coordinate demonstrations against the king, who is reviled by Catalan separatists due to his tough stance against a failed 2017 independence bid.

It is an example of the online battle being waged by Catalan separatists against Spain's central government, which has responded with a controversial crackdown on their online activities.

Anonymous Catalonia has developed software that can analyse and rebroadcast photos with the GPS coordinates of political targets sent in by their supporters to help organise protests against them, as well as follow the movements of police. Anonymous is considered a "threat" by NATO.

They have also hacked the emails of judges on Spain's Supreme Court, which on October 14 sentenced nine Catalan separatist leaders to lengthy prison terms over the failed 2017 independence bid, triggering days of angry street protests which sometimes turned violent.

Meanwhile new secretive Catalan protest group Democratic Tsunami rallies separatists using anonymous messaging apps.

For example, on the day the Supreme Court issued its verdicts, some 10,000 people blocked access to Barcelona airport for hours in response to an appeal from the group.

A Spanish court has opened an investigation into Democratic Tsunami, accusing it of "terrorism", and has asked Microsoft to provide it with the data the group stores on coding website GitHub, which is owned by the US IT giant.

Only two other nations have made such a request according to Microsoft -- China and Russia.

Despite demands from Spanish authorities for Democratic Tsunami's online platforms to be taken down, the Catalan group has managed to remain active by migrating to non-European servers.

Demonstrators wear Guy Fawkes masks, hold Catalan pro-independence "Estelada" flags and placards reading "Freedom for Political Prisoners" during a "Million Mask March" organised by Anonymous and other movements this week
Demonstrators wear Guy Fawkes masks, hold Catalan pro-independence "Estelada" flags and placards reading "Freedom for Political Prisoners" during a "Million Mask March" organised by Anonymous and other movements this week AFP / PAU BARRENA

According to documents seen by AFP, Democratic Tsunami's first website was hosted by a company located in the Caribbean islands of Saint Kitts and Nevis, which is also used by the online "Council for the Catalan Republic", a sort of separatist government in exile launched by former regional president Carles Puigdemont.

Puigdemont's "Together for Catalonia" party has included in its electoral programme a plan to create a digital republic before there can be a real one.

Democratic Tsunami said it also uses Geneva-based encrypted email service ProtonMail, which requires a Swiss court order to give out information on its users.

The Madrid government has responded by publishing a decree authorising the authorities to close websites if they pose "a serious and immediate threat to public order".

The decree also seeks to stem an attempt by Catalonia's separatist regional government to set up a "digital republic" following its failed 2017 independence bid.

The Catalan government's project is modelled after Estonia, which is moving almost all bureaucratic tasks, from voting to medical prescriptions online. It would create a "Catalan digital identity".

"There will be no independence either offline or online," Socialist Prime Minister Pedro Sanchez said last week when announcing the controversial decree.

The head of Spain's association of Internet users, Ofelia Tejerina, told AFP the decree was "very generic" and "introduces limitations of the exercise of fundamental rights such as freedom of expression, freedom of information and the privacy of communications."

In an email sent to AFP, Tsunami Democratic called the decree an "extraordinary measure" which was adopted "without going through parliament" to "reduce fundamental rights".

But Sanchez defended the measure on Thursday, saying its goal was not to "shut down the internet" but instead to "put a full stop to this independent digital republic project", which would use Catalan's personal data to carry out "online referendums" or create parallel institutions.