Spain's Supreme Court is probing a claim by the leader of a far right group that he was tortured after his arrest for unfurling a Spanish flag on the Rock of Gibraltar.

The port on the south coast of Spain has been ruled by Britain since the 18th century, and in June members of the Spanish nationalist Vox party unfurled a giant Spanish flag on the territory's famous Rock in a provocative stunt.

There have been frequent legal squabbles between the UK and Spain in recent years over Britain's ownership of the territory and surrounding waters.

According to legal papers released on Wednesday, Vox leader Nacho Minguez claims that after his arrest by authorities in Gibraltar he was subjected to "torture and crimes against moral integrity", AFP reported.

Minguez claims that police kept him for more than seven hours, frisked him "in a disproportionate manner," stopped him from telling anyone where he was, and denied him a lawyer and food.

Nacho's lawyer, Fernando Sanchez, claims in the papers that he was prevented from meeting Nacho ahead of a court appearance several days later, and detained after taking pictures of the courtroom.

The complaint alleged that the police holding him "recognised that the treatment he and Mr Minguez were being subjected to was due to political reasons and by direct order of the chief minister (head of Gibraltar)."

The complaint has been accepted by the National Court in Madrid, leading to an official investigation.

Gibraltar's Chief Minister Fabian Picardo described the legal proceedings as "frivolous and vexatious."

"I fully respect the Spanish courts and legal system and will therefore not lose a moment's sleep over this case," he said in a statement. "Lawyers will be instructed to deal with this clear abuse of process."