NEW DELHI — India could be on the brink of repealing a 157-year-old law that criminalizes gay sex in what is one of the world’s largest and longest-running LGBT legal battles.

On a sweltering Tuesday afternoon in a courtroom so full people barely had space to turn around, a bench of five judges from India’s highest court began hearing arguments against a law known as Section 377. The law was introduced under British rule in 1861 and states that all sexual activity apart from heterosexual intercourse is "against the order of nature."

If the Supreme Court of India strikes down the law, it would transform gay rights in a country of more than 1 billion people.

Akhilesh Godi, a 25-year-old petitioner from Hyderabad, India, who traveled to New Delhi for the hearing, told BuzzFeed News that making legal history was exciting, but that was not his primary goal. "I came out in my early twenties, and it took me a long time to understand what that even meant," he said. "I battled severe mental health issues and depression, even went on medication. But I feel stronger now."

Godi, an ex-student of the Indian Institute of Technology (a prestigious university that is India’s version of the Massachusetts Institute of Technology), said that as a result of filing the petition as part of a group of 20 students, he has been able to discuss his sexual orientation freely with his colleagues. He is now in the process of helping them set up an employee resource group that is inclusive of LGBT people.

"What I want more than anything else is for other educational institutes to set up support groups and safe spaces for young queer people like me, that are confused and perhaps battling similar mental health troubles."

Nishita Jha / BuzzFeed News

Akhilesh Godi (third from left) with his fellow India Institute of Technology petitioners.

Activists in India have fought a long and difficult battle against Section 377, which was struck down by the Delhi High Court in 2009 only to be restored by the Supreme Court four years later.

The 2013 ruling from two Supreme Court judges described India’s LGBT community as a "minuscule fraction" of its total population, and denied that the queer community faced any persecution under the law, as fewer than 200 people had been arrested in the last 150 years for "unnatural sex." One of the judges even claimed that he had never met a gay person in his life.

With the Constitution in our hearts, we go to our Court, to seek to remove a colonial stain on our collective national conscience. Section 377 your time has come. See you in Court on Tuesday. #section377 @chefritudalmia #iitiansagainst377 @arundhatikatju @barandbench

Previously, the challenges to Section 377 have come through curative petitions — a special plea in which petitioners ask Supreme Court judges to review a matter even though the final judgment on it has been passed, on account of that judgment having violated principles of natural justice.

The list of petitioners includes well-known figures such as dancer Navtej Johar, trans activist Akkai Padmashali, chef Ritu Dalmia, and a hotelier named Keshav Suri.

But there are also new petitioners representing the broad spectrum of society and queer experience, such as HIV activist Gautam Yadav and Arif Jaffar, a 47-year old man who was sent to police custody and tortured for over a month for his sexual orientation under Section 377. (Jaffar has been fighting a separate case against the officers who arrested him for the last 18 years).

A significant proportion of the petitioners against Section 377 are men — in part, this is due to the social stigma all expressions of female desire carry in India, but also because according to former Indian attorney general Mukul Rohatgi, the law penalizes men far more often. "Section 377 in our country will affect mostly men even though the section appears sex-neutral," he said during arguments in court.

Adnan Abidi / Reuters

An LGBT rights activist protests the Supreme Court decision of 2013.

Activists say the most hopeful part of the latest fight against Section 377 is that it is no longer limited to allies or members of the community standing in as proxies for others who are too afraid to come out.

"Every year, especially since 2013, pride marches across the country have grown in size," said Vikram Doctor, a Bombay-based journalist who has worked with Gay Bombay (a group that creates safe spaces for queer men) and been involved with the case from its inception. Doctor told BuzzFeed News that one of the most heartening aspects of this fresh legal battle was the petition filed by 20 current and ex-students of IIT, including Godi.

"The people joining in with petitions at this moment have no history of activism and a lot at stake — many of them come from small towns, and have truly moving stories of fighting poverty, suicide attempts and families that attempted to forcibly marry them off to heterosexual partners."

Arun Sankar / AFP / Getty Images

The petitioners from IIT, nearly all of whom are below 30 years of age, are scientists, entrepreneurs, teachers, researchers, and business owners who describe themselves as the children of farmers, teachers, homemakers and government servants. Seventeen men, two women, and one trans woman described the impact of Section 377 on their lives to the court on Tuesday.

"People think coming out as gay is some kind of happy ending, but it’s not," petitioner Anwesh Pokkuluri said, as the court broke for lunch. "Even after you muster up the courage to speak with your parents or maybe your siblings, there’s still people at work, people you meet socially, or landlords...and as a result of 377, you never know how they will react to the news of you being gay."

Despite this, Pokkuluri said he was eager to join the petition because he is relatively more privileged than others in his hometown in Kakinada, India. "If not me, then who? When I explained my decision to my parents in this way, they understood."

Other petitioners — despite the fact that they were now part of Indian legal history at the country’s highest court — were still to discuss the matter of sexual orientation with their families. One of them, Krishna Reddy Medikonda, said that if his parent learned about his orientation "through this fight," that was probably the best way for them to find out. "In a way, you could say I’m hoping for that," he said, breaking into laughter.

Being treated as "unconvicted felons" — the term Rohatgi used to describe the plight of LGBT people in India — has meant that billions of people have been unable to access sex education and seek medical and legal assistance when required. Despite having received scholarships to some of the most elite institutions in the country, the petitioners from IIT said that they frequently considered leaving India for a country where same-sex love was not treated as criminal. Their petition cites Section 377 as one of the major reasons for a "brain drain" from India.

But there were also some pleasant surprises. As the day's proceedings drew to a close, Romel Baral, a 25-year-old from Bengaluru in southern India who studied at IIT Guwahati and is presently employed at Goldman Sachs, said that his employers were actually the main reason he felt empowered to join the petition. "I knew I would have to admit it some day. I always imagined what it would be like — but seeing how inclusive and warm my colleagues were made it really easy for me to talk about my sexual orientation. When I told them why this law needs to change and why I need to be part of the petition – they told me to make them proud!"

Hearings into the Section 377 petitions will take place over the coming weeks.