As he heads home to Scotland, Jamie Harron will no doubt be feeling euphoric. Winning his freedom a day after being sentenced to three months in a Dubai jail, he will soon be reunited with family and friends. But it is in the days and weeks ahead that I anticipate he will need the most support, not only to make sense of the injustice he has experienced, but to deal with the mental anguish and flashbacks that will inevitably come.

I know, because I have firsthand experience of the vindictive and unjust nature of Dubai’s weak legal system. It is a system rampant with corruption, bribery and nepotism, one that discriminates against westerners and especially Brits, and where the detention of a westerner and specifically, a Christian, seems to be some sort of macabre sport.

Yesterday, just before word came through that Jamie had been handed back his passport at a police station and told he could go, I was calling the German company that employed his accuser, a Dubai-based German businessman. I work with the prisoner advocacy service Detained in Dubai, run by lawyer and activist Rahda Stirling. Although the man who claimed Jamie had touched him had withdrawn his complaint, UAE officials were, until today, pushing ahead with the prosecution and my hope was that they could step in again to help Jamie.

Aside from Harron’s case, I have seen literally thousands of people put through the horror of the Dubai jail system, many of them physically and sexually abused by the Dubai police for simply holding the hand of their girlfriend, having a drink in public or, as in my case, using social media.

Donald Trump lavishes praise on Dubai business partner during New Year's Eve speech

Like Jamie, I was lured by promises of a cosmopolitan lifestyle in Dubai. For many years, it had been my dream “home away from home” before it turned into the place of my nightmares.

Then a managing director for Leeds United, I had been involved in negotiations to acquire the football club from a United Arab Emirates-based company. This had quickly turned sour and we were forced to initiate legal action against them for breach of contract.

In most other countries, this might simply be a legal dispute between two businesses. However, after I flew to Dubai for what I thought was a meeting to resolve outstanding issues, I was arrested and held on fraud and embezzlement criminal charges. Afterwards, the same company filed a criminal complaint against me that I had abused them on Twitter while I was in jail. The case took six months and seven hearings before I was acquitted in March last year.

The only way to describe being in prison in Dubai is hell. I was held for 22 months and I’ll never forget it – the stench, the dirt, the smell, the heat, and the lack of any information whatsoever.

I was punched, Tasered, beaten and raped. The worst of this abuse was perpetrated by the prison guards and police.

Dubai king finds offices empty

I lost a lot of weight through stress. Once, when I asked for some painkillers, a guard hit me over the head with a broom handle. When someone’s beating you or hurting you in whatever form, in a weird way you can deal with that. What I found more harrowing was seeing them do it to other prisoners in front of everyone.

I remember an occasion where they brought a man in from the street, threw him on the floor and stood on his neck, three of them. You cannot imagine how that constant threat of abuse makes you feel. All around you people are being raped, and abused – you get these young kids who come in and get raped. The way they treated people from India and Pakistan was far worse. In that sort of environment, you’re surrounded by the most depraved depths of humanity.

My first mistake was assuming was that I would find protection from the British Embassy in Dubai. I had also hoped to get support from some of retired English judges who are employed by the Dubai International Financial Centre Courts. I wrote to them on many occasions requesting that my case be heard, and pleading with them to help stop the torture and abuse. My complaints fell on deaf ears and I was completely ignored.

Dubai is not a safe place, despite its shiny exterior. Beneath lays a brutal and cold system that is ripe for exploitation by unscrupulous UAE businesses. Mine and Jamie’s are not the only cases. Each case follows a similar pattern: wealthy Emiratis taking advantage of weak laws and corruption, wrongfully extorting civil settlements and stifling any legal threat against them. Dubai is effectively the world’s first corporate jail.

Of course, it is absolutely right that visitors should be respectful of the laws and customs of individual countries. However, punishment is handed out on the filmiest excuses. While I was in prison, I met hundreds of expats who were imprisoned for things they didn’t know were illegal.

After the initial euphoria of coming back to the UK, I began getting intense flashbacks. That really started to affect me. At one point I was taking up to 15 pills a day for depression and sleeping problems in addition to morphine. I was like a zombie.

Thankfully for Jamie Harron, he has been freed on the special order of the UAE prime minister and ruler of Dubai, Sheikh Mohammed bin Rashid al Maktoum. I am convinced this decision was influenced by the worldwide outcry over Jamie’s treatment. After all, the UAE has already been criticised over its role in boycotting Qatar, and it will not want to risk more bad publicity.

UAE: Diplomacy will be given 'one or two more chances' before they 'part ways' with Qatar

It’s fantastic news for Jamie, but what about the thousands of people who don’t get media attention? If the judicial system is so flawed, why does the UAE not take steps to fix it permanently? My view is that it is because it perfectly suits local businesses to keep control over the police and judicial system.

During my ordeal, I was approached by numerous local lawyers who promised the world if I paid them, but vanished immediately afterwards. Like Jamie, I quickly ran out of money. When I finally returned, I decided I couldn’t just sit and watch another person go through what had happened to me with no help.