Qatar has drawn outrage from around the world for arresting and charging a young Dutch woman who had reported her own rape.
The 22-year-old victim was instead arrested for having sex out of wedlock and fined €750.
Her case has highlighted human rights violations in the country, which has already been criticised in the past over its mistreatment of migrant workers.
A court in Doha gave her a suspended one-year sentence on Monday, but released her to be deported back to the Netherlands following an uproar on social media and a successful online campaign which had called for her release.
By blaming women for being raped you're essentially taking part of the blame away from the rapist and putting it on the victim #FreeLaura
— Anood Al-Thani (@Al_Anood) June 11, 2016
The victim, who was in Qatar for a holiday trip, was arrested in March.
According to her testimony, she was drugged at a bar in a Doha hotel.
"Her next memory was waking up in an unfamiliar apartment where she realised to her great horror that she had been raped," her lawyer Brian Lokollo told Dutch radio NOS-Radio 1.
She identified her rapist as Syrian national Omar Abdullah Al-Hasan.
He pleaded guilty to charges of illicit consensual sex and being drunk in a public place and was sentenced to receive 140 lashes.
The victim was on her first independent holiday with a friend, her mother told Dutch newspaper De Telegraaf.
Qatari officials declined to comment after her detention became public knowledge over the weekend and the state-run Qatar News Agency did not report on the verdict on Monday.
The case has once again ignited debate on whether Qatar should be allowed to host the 2022 FIFA World Cup, which draws thousands of youth who consume large amounts of alcohol and party late into the night.
— Devi Boerema (@DeviBoerema) June 11, 2016
On Twitter, Netherlands Foreign Minister Bert Koenders said he was "relieved" by the verdict.
Lokollo said the woman's family were "very pleased" she was released and praised the work of Dutch diplomats.
He said, "We are very happy she's going to be home soon."
Alcohol is available at high-end hotels in Qatar and duty-free shops at its massive international airport.
However, residents must have permission from their employers to buy at the country's only government-run liquor stores.
Sex out of wedlock in most Middle Eastern countries is illegal.
Qatar does not share rape statistics and women in many cases avoid reproting assault for fear of victimisation.
According to the UN, Qatar has 1.4 rape incidents per 1000 people.