It took him more than two months to prepare, coming up with the concept, assembling his outfit and rehearsing. Then on the big night, a five-hour session putting on makeup. The very last step, he slid on the red lace gloves with 4-inch (10-centimeter) red fingernails that he had specially ordered from the United States.

Elias was transformed into Melanie Coxxx. She was ready for her most important show: The largest drag ball in Lebanon.

Because this is Lebanon, where homosexuality and dressing as the opposite gender are against the law, he sat in the back of his mother's car with darkened windows, a scarf over his head, for the drive from his home just outside Beirut to the club.

That didn't unnerve Coxxx. Elias says his character, inspired by transgender actress and activist Laverne Cox, is "fearless."

"She is the person that makes me more alive, more powerful," Elias said. "When I put everything on... I take the courage (from her). (She is) guiding me to go out and just perform."

Elias has come a long way. His journey was full of rejection, protest and finally limited acceptance. His larger family still shuns him, and he has lost a few friends. But his mother and father came to accept him, and Elias has been openly gay for six years. Last year, he had his first drag show. Still, he asked that his last name not be published out of concern for his safety.

Lebanon's LGBT community has had a similar journey. For over a decade, it has focused on activism to combat discrimination and abuse, making startling gains and even opening some space in the mainstream. The community is the most vibrant and open in the Arab world.

But there is a constant dance between authorities and the community over lines and limits. Last week, it appeared to be a step too far when Pride celebrations were held in Beirut. The widely advertised events came just before the start of the Islamic holy month of Ramadan. After a few events were held, including the drag ball, authorities reacted.

Organizer Hadi Damien was briefly detained. Authorities forced him to sign a pledge not to convene the remaining events or face prosecution for promoting debauchery and violating public morality. As a result, some public parties and events were cancelled. Other more low-key events went on, including workshops and readings, though under a cloud of fear of police raids.

Still, "we are moving forward not backward," said Georges Azzi, a founding member of Lebanon's Helem, the region's first LGBT advocacy group.

"There is a feeling that we are getting stronger, and there is a backlash from the conservative organizations," he said.

The crackdown reignited long-running debates within Lebanon's LGBT community between those who want to celebrate Pride and those who say the focus is still needed on activism and protest to force change.

Since 2005, activists have commemorated the International Day against Homophobia, Transphobia and Biphobia on May 17, mostly with protests, readings, workshops and cultural events. But the exuberant, highly public approach of the Pride celebrations seems to have drawn authorities' ire, said Azzi. Last year, there was an attempt to hold a Pride Week, the first ever in an Arab city, but authorities forced some of its events to be called off, including a street parade.

After his release, Damien argued that "Beirut Pride is changing the discourse, taking things to another level."

The approach, he said, expanded the circle beyond LGBT activists to include politicians, investors and even security officials and away from "attacking people in power." The Beirut Pride Facebook page lists politicians friendly to gay rights.

But Damien got some heat from activists who said signing the pledge set a precedent, and amounted to cooperating with authorities. Critics also said Damien is ignoring their years of hard work.

"We can't thank the system," said Joseph Aoun, a member of Helem. He said the focus has to always be on the security and safety of the LGBT community, particularly the most vulnerable.

Since first raising a rainbow flag in a 2003 protest, activists and civil society have steadily raised the bar.

Law 534, which criminalizes homosexuality as an "act against nature" remains on the books despite efforts to abolish it. At least 76 people were arrested under it in 2016. But more and more often prosecutors release those arrested rather than sending them to court. Four times in past years, courts have refused to apply Law 534, giving defense lawyers a basis to have cases thrown out.

Police stations and doctors have barred the use of anal exams for arrested gays after a public uproar following a mass arrest in 2012.

After lobbying by activists, five lawmakers in the newly elected 128-member parliament have vowed to support LGBT rights and called for decriminalizing homosexuality, Azzi said. The debate over LGBT rights has become part of the mainstream, featuring in TV shows and media reports.

Since Helem's founding in 2005, there are now at least a half dozen other active LGBT advocacy groups. Lebanon boasts openly gay bars and clubs. Its activists are proud to have introduced, in collaboration with Palestinians, a new, positive Arabic word for homosexual, "mithli," to replace the more common, derogatory term, "shazz," or "deviant." Lebanon also created an Arabic equivalent for the acronym LGBT: "The Meem Movement," from the letter 'M' in Arabic, which begins the words for homosexual, transgender, bisexual and questioning.

Lebanon's relative tolerance emerges in part from its sectarian and ethnic diversity. Despite tensions, no one group is strong enough to impose its will, and people are forced to recognize others to a degree. That has made for greater freedom of press, expression and activism than elsewhere in the region.

It is a dramatic contrast to other Arab nations, where even discussing LGBT rights is beyond the pale and media relentlessly demonize the community. Last year, Egyptian police arrested dozens after fans unfurled a rainbow flag at a concert in Cairo by a Lebanese band whose lead singer is openly gay.

Lebanese police have avoided such heavy-handed mass sweeps since 2012. Pressure has forced authorities to stay within "mainstream red lines," said Sahar Mandour, Amnesty International's Lebanon researcher.

But the security forces find other ways. Forcing Damien to sign the pledge was a new method, for example, aimed at making the cancellations seem voluntary.

And there are signs police are tightening the reins in other ways. Recently two night clubs were temporarily shut down — one because dancers performed partially nude, the other because a dance song featured a Quranic verse. Two popular TV talk show hosts were charged with insulting the judiciary and the president because of material on their shows.

Elias was dismissive of the divisions in the LGBT community. More straight people are accepting now, he said, and it's the authorities who are "just afraid that it will boom more."

"I don't feel that anything scares me," he said. "To be accepted is simply freedom."

Elias came out to his mother, Valerie, when he was 18. A relative was taunting him, and suddenly Elias burst out at her: "You know I'm gay. If you have a problem with that, don't look at me."

Valerie said she was shocked. At first, she couldn't look at her son. She and Elias' father sent him to stay with his grandparents in the mountains, took away his phone and laptop and cut him off from friends they blamed for his sexuality.

It took her two years to come to terms. What finally tipped her was her family's treatment of Elias. They said he was sick and needed treatment, or was possessed by demons and needed an exorcism.

"They made me sick. They didn't help me," she said. She also feared for Elias' safety. She keeps close to him.

"He didn't choose to come to this world. He didn't choose his religion. He didn't choose his gender. He didn't choose his society or home," she said. "Should I also deprive him of the right to choose how to live his life?"

Valerie's larger family has not yet accepted Elias. At the launch of Pride week, she joined him at an event bringing parents who support their LGBT children to meet society and the media.

As Elias prepared for the ball, Valerie was there, helping him dress. She wore a "Proud Mama Coxxx" T-shirt to the show.

He says his drag show is as political as it is artistic.

"It is a big in-your-face to society that you can be whoever you want," he said.

One of the ball's four judges was Vivacious, a drag performer from RuPaul's Drag Race. Coxxx mesmerized the audience in full splendor with a red furry coat and red cap. To cheers, she pulled off her cap for her big reveal: dark painted veins running over her skull, painted with help from a professional makeup artist. She strutted up and down the runway in her high heels and displayed her long, brilliant red nails. Coxxx won second prize in the "Club Kid" category.

Then with a change out of the Coxxx persona, Elias was back on stage for the lip-sync category.

In torn jean shorts and a blond wig, he rocked the room with a performance of Kelly Clarkson's "People like Us" — specially chosen for its empowering lyrics.

"Keep your head up, nothing lasts forever. Here's to the damned, to the lost and forgotten," he lip-synced.

He raised a banner reading "Queer Power." The crowd erupted.