BILASPUR, India — If you had told Ayesha Kapur 10 years ago that she would help lead the fight against one of the world’s oldest laws criminalizing gay sex, she would never have believed you. For most of her life, Ms. Kapur was afraid to ever speak of her sexuality.
Growing up in New Delhi during the 1980s, Ms. Kapur knew of no gay women, no reference points from Bollywood movies that could provide the vocabulary for what she was feeling. The word “lesbian,” she said, was “like a bad word.”
Three decades later, Ms. Kapur, who describes herself as deeply private and mostly apolitical, became a member of the first group of gay petitioners to challenge the law, known as Section 377.
In stepping forward, Ms. Kapur, 43, and other petitioners admitted to the court that they were criminals under a law routinely used as a cover to harass, blackmail and sexually assault gay people.
“According to the law of the land, I can be handcuffed,” she said. “It’s a very real prospect. Nothing stops the police from coming to the homes of the petitioners.”
This summer, India’s Supreme Court is expected to consider those petitions as it reviews Section 377’s constitutionality, creating a surge of hope for lawyers and activists who have been campaigning against the law for years.
But hope is tempered by years of disappointment. Even now, it is an act of calculated risk to identify publicly as being gay in India, or to advocate for change.
In interviews conducted over three months, gay and transgender Indians from across the country described the cost of living in a country that has forced them to be outlaws: shunning by parents, social isolation, few protections in the workplace, and a frightening vulnerability to both police abuse and sexual assault with limited legal recourse.
Ms. Kapur, who works in the food and beverages industry, said she came forward because she had finally had enough of all that.
“Why are we invisible?” she asked. “Because we have made ourselves invisible? Or have we been made invisible? I don’t want to be seen as a criminal. That is what this is about.”
In Bilaspur, a sun-cracked city in central India, Rajesh Yadav, slim with sharp cheek bones, said she had been gang-raped four times in less than one year, beaten with a brick and nearly thrown out of a moving vehicle because of her sexuality.
“I would beg them to leave me every time, but they would beat me and use violence against me and then rape me,” said Ms. Yadav, 25, who identifies as a gay cross-dresser and prefers female pronouns. “If I start telling you my story, several nights would pass.”
A., a young gay man who asked to be identified only by his first initial, shared a similar account.
When A., 22, made plans to meet a man from an instant messaging application in eastern India, he was greeted instead by two different men, one of them in a police uniform, who drugged and raped him, he said. Afterward, one of the men took a selfie with A. “I was afraid he would blackmail me,” he said.
Neither of them considered approaching the police to report the crimes, fearing the consequences of doing so.
“Section 377 is cruel,” A. said. “It is being misused to harm people like me. It makes people hide.”
In 2014, when a Bangalore-based doctor did come forward after several men he had sex with extorted about $25,000 from him, the police arrested the men, but then booked the doctor under Section 377, said Danish Sheikh, an assistant professor at Jindal Global Law School in New Delhi.
“The doctor here becomes both victim and perpetrator,” he said. “The law has a chilling effect on your ability to access justice.”
Victims of blackmail or sexual assault often hesitate to approach police for just that reason, fearing they will be arrested — or worse. “The rich ones, they will extort money from; the poor ones, they will use for sexual favors,” said Mohnish Malhotra, a gay-rights activist in New Delhi.
“Nobody talks about these experiences,” he added. “This is not a conversation that people are comfortable with here in India.”
But India was once at ease with depictions of same-sex love and gender fluidity. In Hinduism, gods transform into goddesses and men bear children. Rekhti, a genre of poetry that flourished in India from the late 1700s, describes erotic encounters between women.
When British colonizers arrived in India, that acceptance of homosexuality eroded.
In the 1860s, the British introduced Section 377 of the Indian Penal Code. The law imposed a fine, 10 years’ imprisonment or a life sentence on “whoever voluntarily has carnal intercourse against the order of nature.”
Section 377 is generally applied to sex between men, but it officially extends to anybody engaged in anal or oral sex.
Activists said there had been a few advances in the years since India won independence in 1947, including when government literature distributed in schools last year recognized same-sex attraction. But homophobia here is still often expressed with predatory behavior, and Section 377 narrows channels for recourse.
The push to strike down Section 377 began in earnest in 2000, when a terrified young man showed up at the Naz Foundation, an H.I.V. advocacy organization in New Delhi, pleading for help.
Anjali Gopalan, who runs the organization, said the man’s parents had taken him to a government hospital where he was forced to undergo electroshock therapy to “make him straight.”
After she relayed the man’s plight to India’s National Human Rights Commission, the commission said it could not help the man because he was gay and therefore a criminal. “I was horrified,” she said.
Soon after, Ms. Gopalan filed a lawsuit challenging Section 377, fending off death threats until 2009, when a high court in New Delhi ruled that the law could not be applied to consensual sex. But appeals were filed by Christian, Muslim and Hindu groups and the law was restored by India’s Supreme Court in 2013.
Thousands of gay people who had come out of the closet in 2009 were swiftly pushed back in. Some wealthier Indians left the country for good.
“For the first time, I thought I needed to move out,” said the chef Ritu Dalmia, another petitioner challenging Section 377. “There was this fear — absolute fear.”
In their judgment, the Supreme Court justified the ruling by writing that only a “minuscule fraction of the country’s population constitute lesbians, gays, bisexuals or transgenders.” Since its inception, the court said, less than 200 people had been prosecuted under Section 377.
But figures released by the National Crime Records Bureau, which tracks police complaints, suggest that many more cases are lodged, lawyers said. In 2014, the first year the bureau says it started tracking Section 377 cases, 1,148 complaints were filed. In 2016, the number had nearly doubled to 2,187. That year, over 1,600 cases were sent for trial.
Drawing conclusions from the data is difficult. There is often no way to tell on police complaints whether sex was consensual. Many complaints are filed by third parties who make their own judgments, said Professor Sheikh.
“It is very rarely the survivor who is filing the case,” he said. “The father would file the case saying that, ‘I caught this other person doing a wrongful act with my son.’ ”
Responding to the court’s ruling, a team of lawyers led by Menaka Guruswamy and Arundhati Katju submitted a writ petition in 2016 on behalf of gay Indians. The petition challenged Section 377 on the basis that it violated their rights to equality and liberty, among other infractions, under India’s Constitution.
“We always felt that there was a void,” Ms. Guruswamy said, “the absence of L.G.B.T. individuals saying, ‘This Constitution is mine as well.’”
Initially, three other petitioners joined Ms. Kapur and Ms. Dalmia: Navtej Singh Johar, a dancer; Sunil Mehra, a journalist; and Aman Nath, a hotelier.
Over the last few weeks, emboldened by that group, petitions were filed by 26 others, including Arif Jafar, whose outreach program for gay and transgender people was shut down in 2001 by police who said he was accepting funds from Pakistan to turn Indian men gay.
Mr. Jafar was booked under Section 377 and other laws and spent 47 days in jail, where he was beaten by inmates.
Though most of the petitioners are financially independent, protections that insulate them from the dangers that many gay Indians face, public opinion has slowly shifted in some places. Pride parades were popping up in cities. Parents were coming forward to support their gay children.
Ms. Kapur took her own steps. She left a corporate job where she worked with “superb people” but felt bothered by co-workers assuming that everyone in the office was straight. In 2009, she also came out to her mother, who died of lung cancer shortly after the conversation.
“After I lost my mother, I became a bit fearless,” Ms. Kapur said. “In death, she gave me courage.”
Even if the Supreme Court excludes consensual sex from the law, lawyers said its archaic language means a legislative amendment is needed to protect people who are gay. Still, Ms. Kapur felt hopeful. Messages of support had overwhelmed negative ones, she said.
After the Supreme Court referred Section 377 to a larger bench in January, Ms. Kapur’s father mailed her a framed newspaper clipping of an article from The Times of India profiling the “Famous & Fearless 5.”
Under the clipping, he scrawled a note: “Your mother would have been so proud.”