Angola’s parliament has voted to drop colonial era provisions in its penal code widely deemed to be anti-gay.

Lawmakers in the former Portuguese colony have adopted a new penal code—the first since it gained independence in 1975—which scraps the provision against “vices against nature,” long seen as a ban on same sex relationships, Human Rights Watch reports.

In addition, the government has also banned discrimination against people based on sexual orientation, with offenders liable to face up to two years in jail.

It’s the latest in a recent streak of African countries relaxing anti-gay laws: Seychelles’ parliament voted to decriminalize homosexuality in 2016, a year after Mozambique also adopted a new penal code without a provision believed to target same sex conduct.

But homosexuality remains illegal in several African countries, where antiquated colonial-era laws are maintained. Last year UK prime minister Theresa May urged Commonwealth nations to reform existing anti-gay legislation held over from British colonial rule.While she stopped short of a formal apology, May acknowledged Britian’s responsibility saying: “As the United Kingdom’s prime minister, I deeply regret both the fact that such laws were introduced and the legacy of discrimination, violence and death that persists today.”

Yet, some of the original anti-gay colonial laws have been updated in some countries like Nigeria, where homosexuality is punishable by a 14-year jail term after an anti-gay law was passed in 2014. In Uganda and Zambia, the maximum penalty is life. In Tanzania, an anti-gay crackdown, including arrests, has drawn international criticism and seen aid donors suspend donations.

Even in countries like South Africa, which legalized same sex marriage in 2006, anti-gay sentiments were partly responsible for Inxeba, a movie about an openly gay man undergoing traditional circumcision rites, being initially banned from public cinemas. Similarly, in Kenya, Rafiki, the first Kenyan feature film to be screened at the Cannes Film Festival was banned locally over its plot of a lesbian love story.

Sign up to the Quartz Africa Weekly Brief here for news and analysis on African business, tech and innovation in your inbox