Cases seen as having unusually harsh or lenient penalties in the UAE have raised questions about the Penal Code. But some of the country's leading legal minds say the code lays down clear parameters for judges - while allowing some leeway in sentencing.
Did you hear about the man sentenced to one year's imprisonment for raping his nephew, or the expatriate deported for an inappropriate hand gesture?
Then there was the "car-park killer" sentenced to four years for kicking a female shop worker to death. And what about the two men sentenced to death in Abu Dhabi for selling Dh1,500 of marijuana to an undercover policeman?
While cases such as these hit the headlines because of their seemingly lenient or overly harsh sentencing, legal experts maintain the rulings are correct because judges are operating under a set of guidelines set out by the Penal Code of 1987.
"I trust the courts because it's the judge and he's got a code and a law in front of him," says Diana Hamade, an Emirati lawyer and founder of International Advocate Legal Services in Dubai.
While the Penal Code has received two amendments since its inception, one in 2005 and the other in 2006, it serves the same purpose as any criminal code worldwide - to list the types of crimes recognised by the jurisdiction and the penalties imposed on these offences.
Crime is divided into three categories - felony, misdemeanour and minor offences - with each category dictating differing sentences.
The sentence for a felony, for example, ranges from three years to life imprisonment and the death sentence, the penalty for a misdemeanour from one month to three years, and a minor offence from 24 hours' detention to 10 days.
"Most crimes have a punishment mentioned in the Penal Code that gives the judge two limits - a minimum and a maximum sentence," explains the Emirati lawyer Dr Mohamed Al Hammadi, assistant dean for research affairs and assistant professor of criminal law at United Arab Emirates University, who also runs his own law firm in Abu Dhabi.
"If somebody steals your car, for example, the article in the Penal Code relating to stealing will say this kind of action will be punished by one to two years.
"The judge must then decide what the punishment should be and it depends on the circumstances of the case whether they apply one year, one-and-a-half years or two years."
Any judge deciding a sentence has the discretion to take into account mitigating factors that might reduce a sentence and aggravating factors that might increase it.
If a defendant is less than 21 years old, for example, is committing a crime for the first time, has a family to support or acted in self-defence then the judge may reduce the punishment.
"Some of these factors must be applied - but he has the discretion to apply them or not," Dr Al Hammadi says.
And it is this discretion that can flare up debate over a seemingly unfair punishment.
In 2009, a couple who had severely abused their nine-year-old daughter had their sentence reduced to six years from 10 at the Abu Dhabi Court of Appeal, shocking many including Dr Leena Amiri, a child psychologist who testified at the case and later told The National: "It really sends the wrong message that we are too lenient."
So are there inconsistencies in the way sentencing is applied?
"Yes we do get inconsistencies but that's because of a number of factors," says Ahmed Odeh, a legal consultant with MIO, a law firm in Abu Dhabi.
"A lot of the time, the judge is not looking at the right aspects of the case or he overlooked some of the merits. The rulings may differ but it's fine because you have the appeal courts."
To demonstrate an inconsistency, Dr Al Hammadi refers to a case at Abu Dhabi's Court of First Instance where a bus driver had raped a four-year-old boy.
"Because the defendant did not admit the crime and the prosecutor did not have strong evidence, we thought the sentence would be 10 years but not less than that," he recalls.
"Suddenly we heard the court had sentenced the defendant to one year, so we appealed and the appeal court sentenced the defendant to 10 years.
"We cannot say that the court of first instance's decision was wrong or that the appeal court was correct because the court of first instance applied the guidelines mentioned in the penal code and the appeal court also applied the guidelines."
Dr Al Hammadi adds that, while it is easy to understand the law, it is harder to predict how a judge will apply it when sentencing.
"It depends on the judge's mentality, the defendant, the evidence, the lawyers defending and the effect of that case upon society."
In a felony case such as this, a defendant is tried before three judges. With no jury system, the panel must agree on the final sentence.
"If a man rapes a woman, under the penal code the punishment is the death penalty but, if there is no unanimous decision, it will be reduced to life imprisonment or even one or two years if other mitigating factors are applied," says Dr Al Hammadi.
Whether a case comes to the public's attention through the media can also influence the outcome, with less publicised cases receiving less punishment.
And even the nationality of the defendant can affect sentencing.
"From my experience nationality is a factor," he says. "A UAE national wants to continue his life in the UAE so he will be given a lenient punishment in order for him to be released."
Dr Hammadi recalls a bribery case 18 months ago where he represented an Emirati man working for the government.
"It was a felony case so the sentence should have been three years up to 10 years. The panel sentenced him to one year, which was below the limit because the court applied mitigating factors and one of those factors was because he was a UAE national. In the appeal court, I was able to reduce it to six months because he was a UAE national - but the court will not say that in their decision."
Mr Odeh agrees that nationality can be a factor in reducing sentencing.
"It goes hand in hand with the type of judge. You can't deport an Emirati - where is he going to go? At the end of the day he's going to come back here and the government prides itself on protecting the interests of its own nation. There are barely a million people so there always needs to be a little bit of leniency with them. They are the pride of the nation but you do get Emiratis who get very harsh sentences and fines as well."
Such a policy conflicts with the UAE constitution that stipulates that all people, irrespective of their race, nationality, religion and social position, are equal before the law.
But Dr Al Hammadi says it is not only Emiratis who can receive a more favourable sentence.
"There are other cases where the judge will take nationality into consideration. For example an American citizen may be given a lenient punishment and the same for the British and some European countries.
"There was a case involving an American and other nationalities where the judge gave them a lenient punishment because of their nationalities. The judge did not violate the law when he decided the punishment.
"He can say 'I have the discretion to apply some mitigating factors and it's up to me to decide'."
However, Diana Hamade disagrees that Emiratis receive lenient treatment.
"The only thing you don't see happening with Emiratis is deportation," she says, adding that deportation for expats is necessary because the country values its security so highly.
"We can sleep at night with the door open and feel safe because we have this system. It would be a criminal jungle out there if this didn't happen.
"When it comes to criminal law, we are not talking about my rights, we are talking about a public right to crime prevention and security. The main idea of criminal justice is that we are protecting everyone."
Ms Hamade says it is often the public's lack of understanding of the law that leads them to consider some sentences unfair.
"A woman should not have sex with a man if she is not married but that is not the culture of many people who live in this country. People just ignore that but the law criminalises that behaviour.
"It's the same with alcohol; you are allowed to drink if you are not a Muslim but you are not allowed to be drunk in public."
Confusion over the legal system is something Mr Odeh, a Palestinian who has lived in Abu Dhabi his entire life, is trying to tackle through www.UAEjournal.com, a website he launched in July to unravel the law for the layman.
"There is relatively no legal education for the public," he says. "Crime is a sensitive area and there are a lot of grey areas that are not stipulated in the law.
"While the penal code sets out the types of crimes and the sentencing, the criminal procedure code sets out how the law is applied and how the police conduct an investigation; they have to do it in a legal fashion.
"In a lot of small cases, such as someone not paying the cab fare, things can turn into a big deal because the accused does not know exactly what the procedure is going to be."
Mr Odeh says knowing exactly how an investigation should be conducted can get cases thrown out of court.
"There are certain things the police are allowed to do and certain things they cannot and the authorities don't always apply the law properly. There is language miscommunication as well.
"A lot of the police don't speak English and can't communicate to the person properly what the charges against them are and what is going to happen next. That's when people assume they have no rights."
Ms Hamade adds: "I advise people to understand the country they are living in. It's a country that has opened its arms to the world but it still has certain rules."