When I asked Hassan, a twenty-four-year-old reporter for a local TV channel in Damascus, if he could introduce me to members of Syria’s gay community, he took me to an anonymous-looking bar in the heart of the capital’s Old City. I’d met him two years earlier, in September 2013, while marooned in Damascus on a journalist visa from the Syrian regime. We’d hung out over the course of a week, mostly in that very bar, and I’d gotten to know some of his friends and family. So it took me by surprise when, shortly after we entered the dim, cavernous establishment and found a seat, he looked me in the eye and said, matter-of-factly, “You do know I’m homosexual, don’t you?”

Such carefully choreographed disclosures happen all the time in Damascus, where homosexuality is illegal. I’d had no idea that Hassan — not his real name — was gay, and I was not alone: there were many people in his life who didn’t know. His best friend, who was unabashedly homophobic, had once told him that he could never be friends with a gay man. Nevertheless, the two of them had recently begun to sleep in the same bed. “Just sleep,” Hassan clarified, with a nervous giggle. At once shy and flirtatious, he had a tendency to laugh at almost anything. “We are roommates now.”

As in every other country where gay life is suppressed, homosexuality in Syria has developed its own private language. The Arabic word “jaw,” meaning “weather,” is used to identify someone as gay. “ ‘He is jaw’ means ‘He is from our community,’ ” Hassan told me. Appearances were often a giveaway. Gay men tended to dress better, said Hassan — who’d long ago guessed that I was straight. While there were no gay bars, as such, in Damascus, places like the Old City bar were, in Hassan’s words, “gay-friendly.” A young crowd, composed mostly of gay men, gathered here at least twice a week. “Fifty, sixty, seventy — lots of people,” I was told by a round-eyed, hat-wearing bartender, whom I’d also met on my previous trip to Syria. “Everything happens in here.”

“Except fucking,” Hassan said with a sigh. It was Ramadan, and the only other customers in the bar were two men who sat huddled together on a sofa a few yards away, quietly browsing the Internet. Despite the louche atmosphere — delicate wall lighting; soft, almost inaudible electronica; a few arty pictures of semi-clad women — I was struck by how casually Hassan and the bartender were discussing a subject that was, after all, officially proscribed. It seemed unusual in a city where it can often feel as though everyone is spying on everyone else. When I asked the bartender whether she worried about the secret police, or mukhabarat, she looked incredulous. They’d be as welcome here as anyone else, she said. “What kind of mukhabarat would want to find gays?” Neither she nor Hassan, it turned out, had ever known anyone who was convicted of homosexuality.

In fact, the bar’s young clientele, gay and straight alike, were for the most part supporters — albeit unenthusiastic ones — of the regime of President Bashar al-Assad. It was Assad’s mukhabarat whose torture of children in the southern city of Daraa had sparked an uprising in 2011, and whose harsh suppression of the mostly peaceful protests that followed, including the imprisonment of thousands of Syrians, did much to precipitate the country’s subsequent descent into civil war. For Syrians such as Hassan, however, the armed revolt had become the plaything of foreign powers, and his country the playground of foreign jihadis who wanted to remove every trace of people like him. Like many others, his support for the government did not stem from any heartfelt allegiance to Assad and his corrupt, ruthless regime, but rather from a residual patriotism that reinforced a pragmatic belief in the institutions of the Syrian state — especially the army — as the only means of holding the country together.

What’s more, in recent months the alternative to Assad had come to seem far worse. The Islamic State, which now controls much of the northern part of Syria, regards homosexuality as an abomination punishable by death. At the end of 2014, the group had begun to release a series of videos and photographs that showed allegedly gay men, blindfolded and bound, being pushed from the roofs of tall buildings. Those who didn’t perish in the fall were stoned to death by crowds in the streets below. In some of the photos, the Islamic State’s masked gunmen appeared to embrace their victims, as though in forgiveness, before killing them.

Hassan had seen the images. “Fuck Daesh,” he told me, using a term for the Islamic State that is favored by the group’s enemies, an Arabic acronym that can mean “bigots who impose their views on others.” The sex lives of its fighters, he felt sure, were far more scandalous than anyone else’s: “Donkeys. And goats. In Raqqa” — the de facto capital of its self-declared caliphate — “Daesh do that. Did you see the video?” He was referring to footage that had been making the rounds of the Syrian Internet. I told him that the video looked fake, but he was having none of it; soon he and the bartender were laughing hysterically. “Like horse fucking,” Hassan said. “Somewhere in America they do that.” Playing along, I suggested that the Syrian Army might put together its own gay battalion. The bartender seemed to like the idea. “Jabhat Gayat” (“Gay Front”), she quipped, a pun on the name of Syria’s Al Qaeda affiliate, Jabhat al-Nusra.

If I really wanted to learn about the Islamic State, Hassan told me, I ought to speak to his friend Samir, a young gay soldier in the Syrian Army who’d been fighting jihadis intermittently for the past four years. Samir, a bearded man with a large build, soon arrived with a friend. I said I’d already heard about him. “Seriously?” he asked in mock horror. “Everybody knows about me.” When I offered to buy him a drink, he declined: he was fasting for Ramadan. This was not, he explained, for reasons of Muslim piety but out of devotion to his new boyfriend, a religiously observant twenty-year-old art student whom Samir had been trying to see every day while on leave. The fast included a prohibition against sex, but Samir didn’t seem to mind. Their relationship was “not about sex,” he said. “It’s about feelings.”

The bar was closing, so we decided to walk back to my hotel in Bab Touma, Damascus’s Christian neighborhood. Samir had just come out to the friend he’d arrived with; judging by the latter’s smile, the news had been well received. As we strolled through the Old City’s maze of sensuous alleyways, the conversation turned to politics and the war. “I used to serve in Raqqa as well,” Samir said. “I saw Daesh face- to-face. Without masks.” Like Hassan, Samir was a supporter of the Syrian government, and he seemed unimpressed by the U.S.-led international coalition against the Islamic State. “Americans say they are fighting Daesh, but they drop their bombs in the desert,” he said. “They don’t do anything.” He was also frustrated by rumors that the Assad regime had quietly colluded in the rise of the Islamic State. Six months earlier, he’d met a woman from the United Nations who informed him that the Syrian Army wasn’t really fighting the jihadis. “What do you think we are doing in Deir al-Zor, then?” he asked her, referring to a northeastern province that was largely under Islamic State control. “The whole world is breaking up Syria,” he told me. He was on the brink of tears. “My country is being broken up, and there is nothing we can do.”

No reliable data about homosexuality in Syria exists, but compared with other countries in the Middle East it is said to be something of a safe haven for gay men and women. Although Article 520 of the country’s 1949 penal code stipulates a prison sentence of up to three years for “unnatural sexual intercourse,” the law is not strictly enforced. In an article for The Spectator, the British writer John R. Bradley recalls visiting a Damascus coffee shop several years before the start of the civil war. He was propositioned by another man almost immediately: “It turned out that the coffee shop — packed with men of all ages and types, from English-speaking teenagers to elderly Bedouins — was a pick-up joint.” As long as they were discreet, Bradley concluded, gay men in Damascus enjoyed significant freedom.

If anything, this freedom has only increased during the past four years. Preoccupied with political opposition, the secret police had long turned a blind eye to merely sexual dissidence; now, in the middle of a conflict that has seen more than a quarter of a million deaths, they have more pressing concerns. “They don’t care,” Hassan said. “That is because the mukhabarat is busy, yes, but also because the whole society is busy now. People mind their own business.”

To be sure, Syria is not without its share of antigay sentiment. A few days after my meeting with Hassan, I raised the subject with a group of policemen and pro-Assad paramilitaries who were patrolling the industrial outskirts of the government-controlled city of Aleppo. Would homosexuality, I wondered aloud, make a good subject for a foreign journalist? The English speakers among them looked at me as though I’d insulted their mothers. “Sodomy is dirty,” one of them said. “Do not write about this,” my translator and minder added. “It is not Syrian.”

During the early stages of the uprising, which was inspired by the Arab Spring, some in the gay community had been sympathetic to the protesters’ cause. When I first met Hassan, in 2013, he bemoaned the corruption of the country’s ruling elite and told me how, in the beginning, he’d been torn between the sclerotic but familiar regime and the youthful, idealistic rebellion. That he’d finally sided with the regime didn’t mean that he was happy with the status quo. “We can hold hands, we can kiss each other on the cheek,” he told me in the bar. “But we can’t do the gay thing.” Public expressions of homosexuality remained taboo.

Still, he recognized that he was in no position to redress this injustice. In addition to being gay, Hassan was an agnostic from a Shia Muslim background — and thus, in the eyes of many of the Sunni Islamists, not only a reprehensible sinner but also a heretic. Like Syria’s homosexuals, the country’s religious minorities have mostly lined up behind Assad; the only difference is that the homosexuals are invisible. “The Syrian regime is not bad for gays,” Hassan had reminded me that night in the bar. “It is not good, but it is not bad. “We don’t have rights, but at least we are alive.”

The day after I returned from Aleppo, I met Samir on the second floor of a brasserie in downtown Damascus, where he believed it would be safe for us to talk. The exuberance with which he greeted me disappeared the moment we sat down. “I am not comfortable with this,” he said. Active-duty soldiers were not allowed to speak to foreign journalists. He decided that he would proceed with the interview only on the condition that I turn off the recorder on my phone and not use his real name.

Samir first realized that he was gay when he was six years old. It happened in a swimming pool. “I saw the boys and the girls,” he said with a grin, “and I realized I preferred the boys.” It was only later, in 2001, on the cusp of his teenage years, that he learned about homosexuality; until then he’d assumed he was one of a kind. He spent years in denial, and even proposed to a woman he’d been dating. They were engaged for twelve months. When at last he told her the truth, it took him a moment to convince her that he wasn’t pulling her leg. They stayed friends after they broke up.

In 2009, Samir came out to his mother. She wept when he told her, but has since come to accept the reality. (His father and brother remain in the dark.) Around the same time, he began a serious relationship with another man, but it fizzled out after he was called up to active duty in 2011, at the beginning of the revolt. In peacetime, military service typically lasted eighteen months, but so far Samir had been in the army for four and a half years. Every three months he got fifteen days of leave, and it was on one of those days, three months earlier in Damascus, that he had met the young art student whom he was dating now. Samir said that he knew roughly three hundred gay people in Damascus, most of them men. None had ever been arrested, as far as he knew, and the bars that they frequented didn’t mind their presence, provided that they didn’t “do dirty dancing,” as Samir put it.

All the same, the lack of formal rights for Syrian homosexuals makes them vulnerable. A few months earlier, Samir had been sitting in the bar where we’d first met when a friend of his went off to a date that he’d arranged on Grindr, the gay dating app. Samir had warned his friend not to go, and it turned out that he was right to be wary. The date was a trap: two men set upon his friend, stealing his phone and his wallet. When he returned to the bar several hours later, he was covered in bruises. Samir said that few of the patrons expressed any sympathy; it was his friend’s own fault, they felt. For a long time afterward, people at the bar kept asking to use the man’s phone before announcing, to general hilarity, that it was no longer in his possession. Like Hassan, Samir blamed such callousness on traditional Syrian culture, not on Assad. “Even straight people can’t express themselves fully here,” he said. It sounded more like resignation than a complaint.

Samir knew that things could be much worse. A friend of his had recently left Raqqa in a hurry after the Islamic State’s religious police executed an acquaintance for being gay. According to Samir’s friend, the acquaintance’s father had also been killed, on the grounds that he “didn’t know how to raise” his son.

The other Islamist factions fighting in Syria — Jabhat al-Nusra, Ahrar al-Sham — could be equally barbaric. Samir told me about another friend, an employee of a rebel-friendly media outfit in Aleppo, who left town after members of Jabhat al-Nusra arrested and beat one of his colleagues, a gay man. “Now he hates everyone,” Samir said. “The regime, the opposition.” Although Samir, like Hassan, had once considered joining the revolt against Assad, he’d come to believe that it had done great damage to the country. “They were asking for freedom, but now they are taking our freedom away,” he said. “Not just gay freedom, but everyone’s freedom.”

The only other table in the alcove where we were sitting was occupied by a small family whose members spoke quietly among themselves, but my furtive note taking was putting Samir on edge. As we were talking, a waiter walked up to the father and whispered something in his ear. “If anything bad happens, let me know,” Samir guessed the waiter had said. He worried that we were being watched, and that a raid by the mukhabarat might be in the offing. Within twenty seconds, we’d descended the stairs and were back on the street. I asked him how he could live like this, constantly looking over his shoulder. “It is necessary,” he said. “You might be from the Islamic State.”

At the bar in the Old City, Samir had mentioned an incident he’d witnessed while serving in Deir al-Zor. His comrades in the powerful army regiment known as Division 17 had captured a Swiss-Egyptian jihadi after a failed Islamic State offensive. When I asked him for details, he balked at first: “Too much information.” Only gradually did he elaborate. The jihadi had grown up in Switzerland, and didn’t speak any Arabic; he did, however, have a little English. Samir, one of the few English speakers in the group, was charged with interrogating him. At first the man claimed to be a journalist, but eventually he admitted that he was with the Islamic State. Once Samir had finished with his questions, the prisoner was taken away and executed. This was standard practice, he told me, though on this occasion the soldiers decided to embellish the punishment: “We wanted to get our own back.” There was a video of the man’s headless body circulating on Facebook, Samir said. “I will send it to you.”

He never did send the video, but two days after our abruptly adjourned meeting at the brasserie he offered to show me around Damascus. Sporting a loud, open-necked shirt and wraparound sunglasses, he arrived at our meeting place in Bab Touma with the air of a tour guide. He seemed determined to show me a brighter side of his native city. Our first stop was Abbasiyeen Square, where the national soccer stadium was all that separated central Damascus, which was controlled by the regime, from the insurgents on the other side. Samir pointed at rebel positions only 200 meters away. On the regime side, however, daily life continued much as usual. “People don’t care anymore,” Samir said. “They just want to live.”

Samir was no longer fasting. Three months earlier, in Deir al-Zor, he’d sustained a back injury, and he’d been on sick leave ever since. A bomb thrown at his vehicle by Islamic State militants had, he said, blown him “ten meters” into the air, and he’d landed awkwardly; the injury had begun flaring up, and he was taking painkillers. “The Koran says I should eat,” he said, explaining the exemption from the fast that he’d granted himself.

On a pleasant stretch of road lined with villas, we stopped at a juice bar selling harissa cake, a local delicacy that Samir insisted I try. As we enjoyed our semolina sweetmeats, he showed me his phone and gleefully pointed out that Twitter had incorporated rainbows into its logo, a show of support for the recent U.S. Supreme Court ruling that guaranteed same-sex couples the right to marry. Samir approved wholeheartedly.

Samir had asked his boyfriend to join us, but he’d declined. “We cannot trust anyone,” he told Samir, voicing a suspicion of the Western media that is common among Syrians who oppose the armed rebellion. “He will change the story.” The two men hoped one day to emigrate to Europe, so that they could adopt a child — a nonstarter under Syrian law. For once, Samir believed, his sexual orientation might actually be useful. “I know that if I went to the Swedish Embassy in the region and said I was gay I might get a visa,” he said, rolling his eyes. “But I would only do that if I’m very desperate.”

The conversation turned to religion. Like roughly 75 percent of Syrians, Samir is a Sunni Muslim; Assad and many of his top allies in the government and the military are Alawis — members of a Shia sect that adheres to a disputed interpretation of Islam and constitutes only around 10 percent of the country’s population. Nevertheless, Samir resented what he saw as the foreign media’s tendency to frame the civil war as an essentially sectarian conflict. While serving in Raqqa, he and his comrades had caught a CNN report about Assad’s “Alawi-dominated army.” They fell down laughing. “Of the fifteen of us, eleven were Sunni, there was one Alawi, and the rest were Armenian Christians.” He was similarly resistant to the idea that he might be battling the Islamic State because of its crimes against homosexuals. Hassan had told me that some of Samir’s friends in the army and one of his commanding officers knew that he was gay, but Samir didn’t want to talk about it. “I am fighting for Syria, because they are attacking all communities — Christian, Alawi, and Sunni.” He was a patriot, he said, and that was that.

When we resumed our walk, I asked him again about the incident involving the Swiss-Egyptian jihadi. (Soldiers back from the front are always full of braggadocio and war stories, and I wasn’t able to verify this or the other events he described.) Samir said that he hadn’t seen the execution, only the headless body afterward. In any case, he’d registered his disapproval with the other men in Division 17. “Just because we are living on a farm, it doesn’t mean that we have to behave like animals,” he’d argued. His colleagues took a different view. “We are in a desperate situation,” they said. “We need to show we can fight like them.” In Deir al-Zor, Samir’s regiment had been entirely surrounded by Islamic State fighters; at one point, he said, the Islamists began throwing the freshly decapitated heads of local residents into the Syrian soldiers’ camp, in an effort to terrify them into submission. Samir told me that he’d seen many horrific things in the north, including a series of Islamic State videos that showed Syrian soldiers being executed. After the Division 17 base in Raqqa fell in July 2014, an Islamic State video showed an American-sounding jihadi supervising Syrian soldiers who were being forced to dig their own graves. Samir recognized some of the men’s faces. Another video depicted the killing of a close friend. After hastily shooting a man nearby, Islamic State fighters began taunting Samir’s friend, trying to get him to say, “Long live the Islamic State.” Instead, Samir told me, his friend shouted, “I swear to God we will bury it,” before collapsing in a hail of bullets. He stifled a sob, and we walked on in silence.

Around fifty of Samir’s friends from Division 17 have died since the civil war began, including ten who were inducted into the army on the same day he was. According to the Syrian Observatory for Human Rights, as of October 2015, 52,000 Syrian soldiers have been killed in the conflict, together with 38,000 of their paramilitary allies. The Syrian Army also stands accused of massacres and wholesale human-rights abuses, including torture, the shelling of residential areas, and the dropping of improvised barrel bombs from helicopters, which have caused heavy civilian casualties. Many young Syrians I’ve encountered in rebel-held areas of Syria and in Turkey have fled compulsory military service. Samir, however, denied rumors of flagging morale. At least in his regiment, he said, everyone was happy to do his part. “In Syria, families have a saying: To become a man you must serve your country.” At the same time, it was clear that more than four years of armed struggle had taken their toll. Nine months earlier, Samir had visited a doctor, complaining of insomnia and crying fits. He was given antidepressants. Even now, sleep remained elusive, and he was in constant touch with his unit in the north to make sure that no harm had come to anyone else.

The afternoon heat was intense, and Samir decided to call a halt to the tour. On our brisk walk back to my hotel, he assured me that he’d never killed anyone. “I wouldn’t hurt a sheep,” he said. “But I would kill a Daesh fighter, because they would kill me. I think we should kill them. It is a disease. They are like zombies.”

The night before I left Syria, I arranged to go back to the bar in the Old City with Samir. He arrived to meet me in Bab Touma Square with a wispily pretty, slightly lugubrious young man. His boyfriend, he said, introducing us. While we waited for Hassan and his sister, who were also going to join us, a gaggle of excitable young men passed by, clutching what looked like handbags. Samir and his boyfriend groaned. “They are the kind of people who give gays a bad name,” the boyfriend said. Finally, Hassan’s sister walked up alone. Her brother’s best friend, the one he’d told me about, had decided to travel illegally to Europe. Like me, he would be leaving the next morning. Hassan had been up all of the previous night saying goodbye to him, and now he was at home, sulking. He was in no state to socialize.

It was still Ramadan, and we arrived at the bar to find that we were the only customers. Before long Samir was doing his best to get us all in the party spirit by playing Lana Del Rey songs and videos on his phone. He mentioned that his friend who’d fled Raqqa had told him that the Islamic State inspected the cell phones of everyone who passed through their checkpoints. “There are ten lashes for a song, twenty lashes for a video — there is a whole list. Everything is haraam.” As we looked for more music to play, I noticed that the screen of his phone was cracked. It happened in Deir al-Zor, he said, in the same explosion that left him with a bad back; a friend of his had perished in the attack.

One violent death seemed inevitably to remind him of another. An Armenian friend of his from Aleppo had been killed at the Tabqa Air Base, in Raqqa province, which was overrun by the Islamic State in August 2014. In the hours before the base fell, Samir and his friend had been messaging each other. “Ask my parents to forgive me,” the friend wrote — he hadn’t told them he’d been sent to such a dangerous location. The Islamic State took no prisoners, but Samir had spoken to a soldier who escaped the battle. The enemy had run at them “like wild animals,” Hassan said, summarizing the soldier’s report. “When some of them fell, the rest would keep on running.” Syrian Army helicopters attacked them with bombs and rockets, but the Islamic State “would keep running over the bodies of their dead.”

Before long, Samir and his boyfriend were discreetly canoodling. Samir told me that his boyfriend had begun work on an art project about their romance; it was called “Two Green Hearts Against the World.” The boyfriend showed me some haunting abstract drawings on his phone. During our tour of Damascus, Samir had laughed off the suggestion that gay marriage in Syria would be a good idea, but now, enjoying himself among friends, he said that it might be a fine thing. I proposed that Syria would be free when people could openly ridicule the president. Samir’s boyfriend sniffed and said, “He will leave.” I joked about buying an i love bashar badge I’d seen earlier that day, and how unpopular that would make me at home. “I wouldn’t wear it,” Samir’s boyfriend said.

As we headed out into the street, young men in khakis were clowning around; the mood was rowdy, militaristic. Samir slipped his hand under his boyfriend’s arm in a protective embrace, but no sooner had he done so than a crowd of brawny revelers came up behind us, yelling at one another and dragging a motorbike behind them. Samir pulled his hand away.

The last time we’d walked this way to my hotel, a week earlier, Samir had said, “I love Damascus, but I think we will all have to leave.” It sounded like moody resignation, but maybe his plan was afoot even then. Three months after I left Syria, at the end of September, he quietly defected and fled through the northern part of the country with the assistance of rebel friends. It was a hair-raising journey, and one that he made entirely alone; he’d been given safe passage by brigades linked to the Free Syrian Army, and even dealt with Jabhat al-Nusra along the way. By the time I spoke to him on the phone in October, he was in Antakya, Turkey, where he’d been joined by his boyfriend.

Samir explained that he hadn’t changed his mind about anything he’d told me — his patriotism, his commitment to the army. He simply couldn’t see a happy ending for himself or for his country, and he didn’t want to die for the Syrian regime at the hands of the Islamic State. “I don’t support any side of this dirty war now,” he said. “All the countries are in Syria: the U.K., the U.S., Russia. I just want to be away from all this, in Europe. I believe in peace, in causing no harm to anyone.” His goal was to reach the Netherlands, where he and his boyfriend could marry. In a text message he sent me at the end of October, he said that they were on their way from Athens to Macedonia, part of the exodus of Syrians in search of sanctuary in Western Europe. By December they’d reached Germany and had settled, at least for the time being, in a city near Frankfurt, where, Samir said, the people they’d met had been good to them. “I will be alive, thank God,” he told me, when we spoke on the phone in October, clearly still reeling from the magnitude of what he’d done. “But I can never go back to Damascus.”