Dubai's ruler has pardoned a British man a day after he was sentenced to three months in jail for touching another man at a bar, a legal advocacy group said on Monday.

Jamie Harron, an electrician working in Afghanistan, was convicted for public indecency after being accused of touching a German man's behind in a bar.

Harron, 27, denied the charges and said he brushed past the man by accident as he pushed through the crowded room.

The incident at the raucous Rock Bottom bar, popular among Dubai's many wealthy and often tipsy foreign residents and tourists, was reported to police by the accuser.

"By special order of the Ruler of Dubai, Sheikh Mohammed bin Rashid al-Maktoum, Jamie Harron has been freed. The cases against him have been dismissed, and the sentence imposed by the court yesterday has been nullified," said Detained in Dubai, a group that assists foreigners facing legal problems in the emirate.

A Dubai courts spokesman did not immediately respond to Reuters' request for comment.

An airlines, business and tourism hub with looser alcohol policies than most Gulf Arab neighbours, Dubai still maintains strict laws against public indecency and homosexuality.

Radha Stirling, head of Detained in Dubai, said she hoped cases like Harron's would not happen again.

"Of course, a fully functional legal system would not require outside intervention, and a case like Jamie's would never proceed in the first place. But we are enormously grateful to Sheikh Mohammed for stepping in."