A Scottish man who was prosecuted in Dubai for touching a man’s hip has been freed a day after being sentenced to three months in jail, his supporters have said.

Jamie Harron, 27, was told on Monday morning that the case against him had been dropped by special order of the United Arab Emirates prime minister and ruler of Dubai, Sheikh Mohammed bin Rashid al Maktoum, according to the campaign group Detained in Dubai.

Harron was initially arrested for public indecency for touching a man’s hip as he carried a drink through a crowded bar in Dubai on 15 July. The electrician, from Stirling, claimed he was simply trying to avoid spilling his drink when he brushed past the man at the Rock Bottom bar.

The Detained in Dubai advocacy group, which has been supporting Harron, said on Monday he had been handed back his passport at a police station and told he was free to leave. The government of Dubai has not responded to the Guardian’s request for confirmation.

On Sunday Harron was sentenced to three months in prison for the public indecency charge and told he faced further court proceedings for drinking alcohol and allegedly swearing at the businessman he touched.

Radha Stirling, the chief executive of Detained in Dubai, said Harron was “understandably nervous” when he was called in by the police on Monday morning.

When he arrived at the police station, she said, his passport was returned and he was told he was free to go. “The charges were dropped, the sentence annulled, and he faces no order for deportation. This came by direct order from Sheikh Mohammed.”

Stirling added: “We wish to express our deepest gratitude to Sheikh Mohammed for his personal intervention in this case, and for exonerating Jamie at long last. It has now been established that the allegations against Jamie were entirely unwarranted, defamatory and meritless, to such an extent that the ruler of the country found it necessary to step in and correct the wrongful action of the public prosecutor and to quash the judgment of the court.

“This was a courageous and honourable decision on the part of Sheikh Mohammed, and while it highlights the urgent need for judicial reform in the country, it is also a hopeful sign that the UAE’s leadership possesses the will and vision to pursue such reforms in the future.”

Stirling said on Sunday that Harron had “suffered tremendously” as a result of the allegations, had lost his job, faced losing his home and was struggling to pay his legal bills. He was detained in prison for five days after his arrest, she said, and his family has been unable to visit him without facing imprisonment themselves.

Groups that campaign for reforms in the Emirate state welcomed the move but called for Sheikh Mohammed to overhaul the country’s judicial system.

About 1.5 million Britons visit the UAE every year, according to the British government, with Dubai an increasingly popular destination for holidaymakers.

But the government warns travellers from that UAE laws and customs are very different to those in the UK and that there may be serious penalties for doing something that might not be illegal in the UK.

All sex outside marriage is illegal, for example, and public displays of affection are frowned upon and can result in arrests. Alcohol is served in licensed hotels and clubs but it is a punishable offence to drink, or be under the influence of alcohol, in public.

The International Campaign for Freedom in the UAE said: “Since the Arab spring of 2011, repression has been rapidly stepped up by the UAE authorities, which has seen both Emiratis and non-Emiratis arbitrarily detained, forcefully disappeared, and in many cases tortured on the most frivolous of charges.

“It is imperative that Jamie’s case be understood within this wider climate of repression inside the UAE and that the British government do more to inform its citizens about the real risks and dangers of travelling to the country.”

