A Mallorcan rapper convicted of praising terrorist groups won a legal battle in a Belgian court against his proposed extradition to Spain.

Valtonyc, whose real name is Josep Miguel Arenas Beltran, was sentenced by a Spanish court to 3-1/2 years in prison in 2017 for praising the violence of Basque separatist group ETA and a now defunct left-wing group in song lyrics.

He was also convicted on other charges including insulting the Spanish monarchy. Spain sought his extradition when he fled to Belgium in 2018 after losing an appeal.

The case has drawn criticism from international organizations, such as Amnesty International, which say Spanish authorities are cracking down on free speech.

A Belgian court ruled in December that Valtonyc should not be extradited because the offences were not crimes under Belgian law, prompting prosecutors to appeal.

The prosecutors in the city of Ghent said on Tuesday that the Belgian court of appeal had rejected their case. They could still appeal again to Belgium's Supreme Court.

Valtonyc's Belgian lawyer Simon Bekaert tweeted: "Victory. Court of appeal ruling Ghent".

Valtonyc retweeted a video of himself speaking to reporters after the ruling, expressing his relief that he would be able to start living again.

"Today was a tough day. I didn't know what could happen," he said. "The big fear of an exile is to be forgotten, but this hasn't happened."