Reyhanli, Turkey: Before a crowd of men on a street in the Syrian city of Palmyra, the masked Islamic State group judge read out the sentence against the two men convicted of homosexuality: They would be thrown to their deaths from the roof of the nearby Wael Hotel.
He asked one of the men if he was satisfied with the sentence. Death, the judge told him, would help cleanse him of his sin.
"I'd prefer it if you shoot me in the head," 32-year-old Hawas Mallah replied helplessly.
The second man, 21-year-old Mohammed Salameh, pleaded for a chance to repent, promising never to have sex with a man again, according to a witness among the onlookers that sunny July morning who gave The Associated Press a rare first-hand account.
"Take them and throw them off," the judge ordered. Other masked extremists tied the men's hands behind their backs and blindfolded them.
They led them to the roof of the four-story hotel, according to the witness, who spoke in the Turkish city of Reyhanli on condition he be identified only by his first name, Omar, for fear of reprisals.
Notorious for their gruesome methods of killing, the Islamic State group reserves one of its most brutal for suspected homosexuals. Videos it has released show masked militants dangling men over the precipices of buildings by their legs to drop them head-first or tossing them over the edge.
At least 36 men in Syria and Iraq have been killed by IS militants on charges of sodomy, according to the New York-based OutRight Action International, though its Middle East and North Africa coordinator, Hossein Alizadeh, said it was not possible to confirm the sexual orientation of the victims.
The fear of a horrific death among gay men under Islamic State rule is further compounded by their isolation in a deeply conservative society that largely shuns them.
Many Muslims consider homosexuality to be sinful. Gay men are haunted constantly by the possibility that someone, perhaps even a relative, will betray them to the militants whether to curry favor with IS or simply out of hatred for their sexual orientation.
Islamic State group fighters sometimes torture suspected homosexuals to reveal their friends' names and search their laptops and mobile phones.
Even among IS opponents, gays find little sympathy. Some in the public who might be shocked by other IS atrocities say killings of gays is justified. Syrian rebel factions have killed or abused gays as well.
A 26-year-old Syrian gay man told the AP that even two years after fleeing to Turkey, he wakes up shaken by nightmares that he is about to be hurled from a building.
The man spoke on condition that he be identified as Daniel Halaby, the name he now uses in his activism tracking IS atrocities, and that the city in Turkey where he lives not be named for his own safety.
Halaby says a childhood friend who became radicalized and joined IS betrayed him to the militants in 2013, forcing him to flee his home city of Aleppo.
"He knew everything about me, such as being secular and gay. ... I am sure he is the one who gave my name to Daesh," he said, using the Arabic acronym for the Islamic State group.
At that time, in mid-2013, IS had just started to spread from neighboring Iraq into Syria.
It didn't yet hold the large stretches of territory across both countries that it would capture the next year.
Instead, its fighters pushed into rebel-held areas in Syria and tried to dominate other rebels, often clashing with them for control and imposing the group's strict law wherever they could.
In September 2013, IS fighters besieged the Aleppo neighborhood where Halaby lived with his family, trying to wrest it from the rebel Free Syrian Army.
The two sides negotiated over an end to the siege and, during the talks, IS gave the rebels a list of people they demanded be handed over to them. Halaby said he learned his name was on that list.
He quickly escaped to Turkey.
There, his bedroom is decorated with a flag of the Syrian opposition and a rainbow banner that covers an entire wall.
His parents, who remain in Aleppo, refuse to talk to him because of his sexual orientation. When he watches videos of gays being killed, he said, "What breaks my heart most is that I feel helpless."
Life for gays in Aleppo, Syria's biggest city, was always hidden, Halaby said. When the secular-led peaceful protests erupted against President Bashar Assad in 2011, he said he quickly joined, sure they would lead to a democratic government "that will respect everyone no matter their religion, ethnicity, sect or sexuality."
"We were very naive," he said. "What happened was exactly the opposite."
Subhi Nahas, a 28-year-old gay Syrian who now lives in San Francisco, said he fled because he feared his own father might turn him in to al-Qaida's affiliate, the Nusra Front, which also has targeted homosexuals.
When his father learned he was gay, Nahas said he called him a shame to the family and beat him. Around the same time, in late 2013, Nusra fighters launched a crackdown on suspected gays in Nahas' hometown of Maaret al-Numan, detaining 25 men and announcing through mosque loudspeakers that they would cleanse the town of homosexuals.
"With the problems between me and my father, I did not rule out that he might (hand me over)," he told the AP.
So he fled, first to Lebanon, then Turkey. But in Turkey, he said, he began getting death threats from a former school friend who joined the Islamic State group. Fearful that he wouldn't be safe even in Turkey, he legally resettled to the United States in June.
In August, Nahas and a gay Iraqi man spoke about the suffering of homosexuals in their countries at the first-ever U.N. Security Council session spotlighting violence and discrimination against lesbians, gays, bisexuals and transgender people.
The stigma surrounding homosexuality makes it difficult to document IS killings and identify victims, rights groups say. Families and friends refuse to talk about victims. Gays under IS rule are terrified to speak, and most who flee abroad go into hiding.
The Islamic State group's announcements are the main source of information, but the group often does not name the victims, perhaps in deference to their families, who could lash out in anger at having their names publicly linked to homosexuals.
"Such a barbaric show of murder leaves LGBT individuals in constant state of fear and would deprive them of a normal life that any human being is entitled to," Alizadeh said.
Widespread public hostility leaves the community even more vulnerable.
"They are violating God's laws and doing something that is forbidden in Islam, so this is a legitimate punishment," said Hajji Mohammed, a resident of the IS-held northern Iraqi city of Mosul. There the group has thrown men suspected of being gay off the Insurance Building, a landmark about 10 stories high.
By employing the grisly method, the Islamic State group aims to show radicals that it is unflinchingly carrying out the most extreme strains in Islam a sort of "ideological purity" the group boasts distinguishes it even from other militants.
The punishment "will protect the Muslims from treading the same rotten course that the West has chosen to pursue," IS proclaimed in its online English-language magazine Dabiq.
The Quran tells the story of Lot and the destruction of Sodom and sodomy in Arabic is known as "liwat," based on Lot's name.
Men having sex with each other should be punished, the Quran says, but it doesn't say how and it adds that they should be left alone if they repent.
The death penalty instead comes from the Hadith, or accounts of the sayings of the prophet Muhammad. The accounts differ on the method of killing, and some accounts give lesser penalties in some circumstances.
The Islamic State group bases its punishment on one account in which Muhammad reportedly says gays "should be thrown from tremendous height then stoned."
Before IS, the method was rarely used, though other militants have targeted homosexuals for death. During their rule in Afghanistan in the 1990s, the Taliban had their own method: The victim would be put in a pit and a stone wall would be toppled on top of them.
Most moderate Muslim clerics ignore the death penalty provisions, even as they fiercely denounce homosexuality.
Across the Arab world, homosexuals have been arrested and sentenced to prison on charges linked to "debauchery" and sometimes lashed in Iran and Saudi Arabia.
Omar, the man who watched the killings in Palmyra, said he remains shaken.
It began when IS militants blared on loudspeakers for men to gather. Then a black van pulled up outside the Wael Hotel, and Mallah and Salamah were brought out.
The first to be thrown off was Mallah. He was tied to a chair so he couldn't resist, then pushed over the side.
He landed on his back, broken but still moving. A fighter shot him in the head.
Next was Salameh.
He landed on his head and died immediately. Still, fighters stoned his body, Omar said.
The bodies were then hung up in Palmyra's Freedom Square for two days, each with a placard on his chest: "He received the punishment for practicing the crime of Lot's people."