India's highest court has recognised the existence of a third gender that is neither male nor female in a landmark judgement hailed by the transgender community.

"Recognition of transgenders as a third gender is not a social or medical issue but a human rights issue," Justice KS Radhakrishnan told the Supreme Court on Tuesday while handing down the ruling.

The court directed state and federal governments to identify transgenders as a neutral third gender who should be granted access to the same welfare schemes as other minority groups in India.

"Transgenders are citizens of this country and are entitled to education and all other rights," said Radhakrishnan, who headed a two-judge bench on the case.

Photo Gallery: Tough times for India's transgender community

The case was filed in 2012 by a group of petitioners including prominent eunuch and activist Laxmi Narayan Tripathi seeking equal rights for the transgender population under the law.

Transgenders are citizens of this country and are entitled to education and all other rights Justice K.S. Radhakrishnan

Tripathi hailed the judgement, saying transgenders have long suffered from discrimination and ignorance in the traditionally conservative country.

"Today, for the first time I feel very proud to be an Indian," Tripathi told reporters outside the court in India's capital, New Delhi.

"Today my sisters and I feel like real Indians and we feel so proud because of the rights granted to us by the Supreme Court," Tripathi said.

The decision comes after the same court last December reinstated a ban on gay sex, in a shock ruling that sparked accusations it was dragging the country back to the 19th century.

Gay sex had been effectively legalised in 2009 when the Delhi High Court ruled that a section of the penal code prohibiting "carnal intercourse against the order of nature" was an infringement of fundamental rights.