Finding sources willing to speak with me was challenging. I contacted the groups working on L.G.B.T. issues in India and asked if they knew of anyone who had been targeted by Section 377. The answer was almost always the same: The people they knew would not speak on the record, or were caught in legal binds, or were simply afraid. The risks of family ostracism, extortion or police involvement weighed on many people’s minds.

Posting in closed Facebook groups for L.G.B.T. Indians sometimes worked. Several men privately messaged me, saying they were comfortable with part of their names being published. To my surprise, it was easier speaking to people in villages than in cities. One lower-income gay man, who lived alone in a shoebox room in India’s interiors, defiantly told me he had nothing left to lose. In the last year, he had been raped several times, he said.

Traveling around the country, I found that progressiveness on the issue did not necessarily predict progressive mores on others. In a rural patch of central India, a transgender woman told me she planned to break up with her boyfriend because “he should marry a woman of the same caste.” Later, in a city a few hundred miles away, a gay man ran his fingers along my arm and remarked on the whiteness of my skin, saying he wished he were fairer; it was more attractive, he said.

When my questions were perceived as too pointed, I was told to worry about my own country’s problems. After I met a police superintendent leading sensitization training in a nearby district, I informed him that transgender locals often felt unsafe approaching law enforcement officials. Clearly irritated, he posed a question: “Aren’t transgender people all in the mafia in the United States?”

As I dug in, I weighed whether to reveal my sexuality in interviews, looking for ways to set people at ease, but also wondering whether the idea was connected to my own loneliness. Section 377 thwarts the formation of supportive communities — it is not uncommon for cops to demand bribes from party organizers at the few clubs in Delhi that hold events for the gay community.

The loneliness was jarring. Many nights, I stared at the ceiling and cried. I wondered if other people here felt the same way. Through my reporting, I realized some of them did.

Among the more affecting interviews was one with a young man who went by A., his first initial. In conversations that lasted for hours over text, Facebook and in person, A. recalled the night in 2014 when he was drugged and raped by two men at the bare-bones hostel of a medical college.