New Delhi (CNN) India's Supreme Court has reignited the debate over one of the country's most controversial laws -- the criminalization of homosexual acts.

In a surprising change of events, the top court announced in 2016 that it would hear a clutch of petitions asking for the law to be struck down. This comes after a judgment by the same court five years ago that upheld the criminalization of homosexual acts

Section 377, as the law has come to be known, criminalizes, "whoever voluntarily has carnal inter¬course against the order of nature with any man, woman or animal."

"In view of the above discussion, we hold that Section 377 IPC does not suffer from the vice of unconstitutionality and the declaration made by the Division Bench of the High court is legally unsustainable," the court ruled in 2013.

"It is a wrong precedent. It was a wrong judgment. It was not legal and it was based wrongly on the tenets of the constitution," said Colin Gonsalves, one of the lawyers representing the petitioners.

History

In 2009, the Delhi High Court had ruled that the ban on gay sex violated the fundamental rights of a citizen. The court, in the first judgment of its kind, ruled that homosexual acts were legal.

But the Supreme Court set aside the lower court's ruling in 2013 and announced that the archaic Indian law did not violate privacy rights or a citizen's constitutional rights. The two judges hearing the case also ruled that since the lesbian, gay, bisexual and transgender community formed a "minuscule fraction of the country's population," the case could not be the basis to declare a violation of rights under the constitution.

In 2016, the Supreme Court agreed to hear a petition challenging the 2013 verdict and the conversation on legalizing gay sex began once again.

Impact of the hearings

The latest round of hearings is being watched closely by the LGBT community in India. After a series of setbacks, lawyers and activists saw a chance for change last year, when the Supreme Court ruled : "Sexual orientation is an essential attribute of privacy. Discrimination against an individual on the basis of sexual orientation is deeply offensive to the dignity and self-worth of the individual."

The court also ruled that each individual deserves equal protection. "In a democratic Constitution founded on the rule of law, their rights are as sacred as those conferred on other citizens to protect their freedoms and liberties," the judgment read.

Overruling the previous court ruling that dismissed the "so-called rights of the LGBT persons," the constitutional bench of the Supreme Court mandated that the rights of the LGBT community are "real rights founded on sound constitutional doctrine."

In a country where homosexuality is not understood or accepted by the masses, legal acceptance could end the harassment and persecution that law enforcement officials inflict on the community.

Challenges

An Indian gay-rights activist takes part in a protest in Kolata against the 2013 Supreme Court ruling reinstating a ban on gay sex.

The law in question -- a colonial legacy passed down by the British -- has been in place for almost 157 years.

Six petitions that have challenged the previous Supreme Court ruling are being addressed by the court on Tuesday.

Section 377 can stay in place but the part that does not allow consenting adults to engage in gay sex needs to be taken out of its purview, said Sunil Fernandes, one of the lawyers representing the petitioners.

If the law is ruled unconstitutional and homosexual acts are decriminalized in India, India can leave the tiny group of countries that still persecutes homosexuals.

However, the ruling may not be able to provide relief to the people who have already been charged or imprisoned under this law.

Persecution under the law

According to the National Record Bureau, more than 2,100 cases were registered under the law in 2016. India did not maintain a separate database of prosecution under section 377 until 2014.

Arif Jafar, one of the petitioners, was arrested in 2001 under the law and spent 49 days in jail. He has since been fighting for the law to be changed. Jafar runs an informal support group in the northern state of Uttar Pradesh. The group, named "Trust," provides counseling, support and sexual health services to gay and transgender persons.

In his petition, Jafar describes the experience as dehumanizing and a violation of his fundamental rights. He has also alleged that he was beaten and humiliated every day because of his sexuality. It is this petition, along with five others, that is expected to overturn the old law.

The hearings are expected to be wrapped up in the next two weeks, said Fernandes, and a ruling that the Indian gay community has been waiting for seems to be in the offing. The lawyers are optimistic that it will finally bend in their favor.

Last year's ruling eviscerated the 2013 judgment, said Gonsalves. "There is no issue now. There is not much left to argue," he added.