Spain's most senior court fell victim to a massive cyber attack as hackers launched an "Operation Free Catalonia" campaign.

The country's constitutional court said unknown hackers had accessed its computer systems on Friday.

The Spanish National Security Department said the hack was part of a recent campaign to flood government websites with slogans in support of independence for the Spanish region of Catalonia.

Social media groups linked to cyber hacking group Anonymous said they would roll out action as part of "Operation Free Catalonia".

Meanwhile, Spanish attorney general José Manuel Maza is reportedly preparing to have Carles Puigdemont - president of Catalonia and figurehead of the independence movement - arrested for rebellion.

Carles Puigdemont reportedly faces arrest if he formally declares independence (
Image:
REX/Shutterstock)

El Pais reported Puigdemont faces a charge of sedition, punishable by up to 30 years in prison, if he formally declares independence or tries to change the Spanish constitution.

It comes after the regional leaders of Catalonia - including Barcelona - held an independence referendum earlier this month on whether to break away from the rest of Spain.

The referendum - beset by allegations of police brutality - has divided opinions across Spain (
Image:
REX/Shutterstock)

The separatists claimed victory with a majority of more than 2million votes, but the ballot was declared illegal by the government in Madrid .

There were allegations of police brutality as officers used force to break up pro-independence rallies and close polling stations.

Spanish Prime Minister Mariano Rajoy says the referendum was illegal (
Image:
Getty Images Europe)

Spain's Prime Minister Mariano Rajoy on Saturday said he would curb the powers of the parliament of Catalonia, sack its government and call an election within six months in a bid to thwart the independence movement.

It came after Puigdemont failed to meet a deadline to withdraw the threat of a declaration of independence, instead accusing Madrid of refusing to negotiate.

Spanish national riot police evict a young woman during clashes at a polling station earlier this month (
Image:
REX/Shutterstock)

"If the government continues to impede dialogue and continues with the repression, the Catalan parliament could proceed, if it is considered opportune, to vote on a formal declaration of independence," Puigdemont said in a letter to the Prime Minister.

He also said after the referendum: “At this historic moment... I call for the right for Catalonia to independent and form a republic."

The pro-independence flag is flown at a rally in Barcelona (
Image:
Getty Images Europe)

The Prime Minister responded in parliament on Wednesday: "It's not that difficult to reply to the question: has Catalonia declared independence?

"Because if it has, the government is obliged to act in one way, and if it has not, we can talk here."

The measures to curb Catalonia's autonomy and hold fresh elections must now be approved by Spain's upper house, the Senate, where a vote is scheduled for October 27.

King Felipe used a prize-giving ceremony in the north-western region of Asturias to indicate support for the government.

The king, normally a ceremonial figure, said: "Catalonia is and will remain an essential part. Spain needs to face up to an unacceptable secession attempt on its national territory, which it will resolve through its legitimate democratic institutions."