Mozambique decriminalized homosexuality Monday when a new penal code came into force that swept away old Portuguese colonial laws, in a victory for campaigners for gay rights.

The old code, dating back to 1886, targeted anyone “who habitually engages in vices against nature” — though no known prosecutions took place after Mozambique became independent in 1975.

Breaking the law was punishable by up to three years of hard labor.

“It's a symbolic victory, as social inclusion remains the main challenge,” Frank, a student gay rights activist who declined to give his full name, told Agence-France Presse.

The new penal code, which was announced last December by then President Armando Guebuza, also decriminalizes abortion after lobbying by civil rights organizations.

Women can now end a pregnancy until the 12th week. Extraordinary circumstances, such as rape or threats to the mother's life, allow for the procedure until the 16th week.

The code came into force on Monday, though no official events or celebrations were scheduled to mark the occasion.

The majority of African countries outlaw homosexuality, but Mozambique has seen little anti-gay violence or social friction over the issue.

Dercio Tsandzana, an influential blogger and activist, said there had been an absence of public discussion over homosexual rights.

“The government instead abides by the external pressure put by some embassies and foreign donors,” he said.

“Most Mozambicans don't deny homosexuality, but one can't say either that it is accepted.“

Despite a seven-year campaign, the Mozambican government has not officially recognized Lambda, the only gay rights organization in the country.

In neighboring Zimbabwe, President Robert Mugabe is known for his crusades against homosexuality, and discrimination is widespread across the continent.

Homosexuality is punishable by death in Sudan, Nigeria and Mauritania.

Al Jazeera and Agence-France Presse