Sri Lanka's 1883 penal code, a legacy of its British colonial rulers, makes sex between men punishable by 12 years in jail, although the law is rarely enforced.
Health Minister Rajitha Senaratne said the cabinet had refused to endorse a provision in a proposed human rights plan that would have undermined the code.
"There was a provision referring to the sexual orientation of individuals and we clearly said it was not acceptable," said Senaratne, who is also the government spokesman.
He said the proposed National Human Rights Action Plan included a provision to remove "discrimination based on sexual orientation".
More From This Section
"People could interpret this (rights plan) in their favour," the minister said, adding that the government did not want to create "social problems" by inviting a challenge to the law.
Following intense campaigning by a gay rights group in 1995, the then government agreed to review the penal code that prohibited sex between men.
Rights activists say although there have been no known prosecutions in recent decades, Article 365 of the penal code is discriminatory and stigmatises homosexuality.
They also argue that it has led to the abuse of gay people.