The 55-year-old man intends to take his case to Switzerland's highest court after Fribourg cantonal court backed a decision by the canton's migration authorities to withdraw his resident permit, reported 20 Minutes and local paper Freiburger Nachrichten.
The man, who was born in Switzerland and has never lived in Spain, was first in trouble with the law at the age of 17.
Over the years he was convicted of many offences including theft, drug crimes, road traffic offences, damage to property, violence and threatening behaviour, according to the court judgement.
In total he has been convicted of 31 offences and spent over ten years in prison. He has received social welfare benefits since 2012.
The Fribourg migration office withdrew the man's residence permit last year, saying his convictions had not had a dissuasive effect on his behaviour. Despite being born in Switzerland the man had shown no sign of integration or attachment to the country, it said.
It recognized that all his friends and family – including a son – were in Switzerland, but said the public interest in deporting him was bigger than his interest in living in Switzerland.
The decision was recently upheld by the Fribourg cantonal court on appeal.
In its judgement of February 8th the court said that despite the time the man had spent in prison he had not stopped reoffending. Even after being threatened with deportation he had not changed his behaviour.
His behaviour was testament to "his inability to conform to Swiss law and his total reluctance to respect the values of our country".
Consequently, the court deemed the man a danger to the public.
The case will go to the Swiss supreme court at a later date.
Earlier this month Swiss media highlighted the case of another long-term resident who appealed to the same cantonal court after having his permit revoked.
The 27-year-old Afghan, who came to Switzerland as a refugee aged two, lost his appeal after the court said he was unlikely to change his criminal behaviour.
Under Swiss law a refugee can be deported even after many years in Switzerland if he is deemed a threat to security or public order.
And as of this year any foreigner can be deported if they commit a serious crime warranting at least a three-year sentence, such as murder, rape, violent acts, armed robbery and drug trafficking.
The new measures, applicable to crimes committed after October 1st 2016, were introduced after the Swiss public approved a popular initiative on the subject in a 2010 referendum.
Judges do have the right to make exceptions, however.
A person born in Switzerland does not automatically receive Swiss citizenship but can apply for it, however the process can be lengthy and costly.
The Swiss public recently approved a government proposal to make it easier for third generation foreigners (the grandchildren of immigrants) who were born in the country to get Swiss citizenship.