Mauritius' highest court has decriminalised gay sex, saying the ban reflected colonial-era, rather than indigenous values.
British colonialists first criminalised "sodomy" in 1898, but the law has not been enforced in recent years.
The gay man who brought the case said he was "now free to love whoever I want to without fear".
The ruling comes at a time of rising homophobia and tougher anti-gay laws in some African states.
Most notably, Uganda's President Yoweri Museveni signed a controversial Anti-Homosexuality law in May that imposed the death penalty for "aggravated homosexuality", which refers to sex with children or rape.
Many people in Uganda and other African states argue that homosexuality is "un-African", and contradicts their religious beliefs.
The case in Mauritius was brought by Abdool Ridwan Firaas Ah Seek, who argued that the "offence of sodomy" breached his basic rights, including the right to liberty.
The Supreme Court said the law did not "reflect any indigenous Mauritian values but was inherited as part of our colonial history from Britain".
It "was not the expression of domestic democratic will, but was of course imposed on Mauritius and other colonies by British rule", the judges added.
The ruling means that people can no longer be arrested for having gay sex, but parliament will have to repeal the law to make it legal.
In court papers, the state had argued that it was not "insensitive" to the concerns of the LGBT community, but the criminal code could be changed by parliament only when "favourable" conditions emerged in society.
Africa Live: Updates on stories from around the continent
Lured into a trap and blackmailed for being gay
Will Kenya be the latest country to pass anti-gay law?
Mauritius gained its independence in 1968, but kept the ban on gay sex.
Religious groups have strongly opposed moves to repeal it.
Abdool Ridwan Firaas Ah Seek said the ruling would help future generations in Mauritius to "fully and freely embrace their sexuality without fear of being arrested".
The Human Dignity Trust (HDT) said it "finally topples" more than a century of "state-sanctioned stigma against LGBT people in Mauritius".
It added that the ruling sent a message to African countries that still criminalised same-sex relations to abolish their laws.
The law in Mauritius imposes a prison sentence of up to five years for gay sex, but "appears to be largely obsolete in practice", the HDT said on its website.
There are 64 countries worldwide that have laws that criminalise homosexuality, and nearly half of these are in Africa.
The Supreme Court of Mauritius - the country's highest court - has decriminalised gay sex, saying the ban reflected colonial-era, rather than indigenous values.
The colonial-era laws date back to 1898. Mauritius gained its independence in 1968, but kept the ban on gay sex - the law has not been enforced in recent years.
The case in Mauritius was brought by Abdool Ridwan Firaas Ah Seek, who argued that the "offence of sodomy" - as the law described it - breached his basic rights, including the right to liberty.
The Supreme Court said the law did not "reflect any indigenous Mauritian values but was inherited as part of our colonial history from Britain".
It "was not the expression of domestic democratic will, but was of course imposed on Mauritius and other colonies by British rule".
The ruling means that people can no longer be arrested for having gay sex, but parliament will have to repeal the law to make it legal.
What's life like for LGBTQ people in Mauritius?
What’s life like for LGBTQ people in Mauritius? Let’s take a look at some of the key equality indicators.
Is homosexuality legal in Mauritius?
Yes. Following the ruling by the Supreme Court, men can no longer be arrested for having same-sex encounters. However legislative change is still required to remove the laws that criminalise homosexuality.
Are there anti-discrimination protections in place for LGBTQ people in Mauritius?
There are some limited protections in place against discrimination on the grounds of sexuality.
Is there Marriage Equality in Mauritius?
No. There is no legal recognition of same-sex relationships in Mauritius.
What’s life like for LGBTQ people in Mauritius?
Mauritius is a socially conservative country.
Reader's Comments
Please log in to use this feature.