Mozambique will remove a seventh-grade natural science textbook from schools after outrage on social media over content that discussed masturbation and homosexuality.

Pupils in the southern African country have studied “The Secret of Life” by Portuguese publisher Texto Editores for the past 18 years.

However, sections of a chapter on sexual orientation and masturbation went viral on social media after being posted on Facebook last Thursday.

The education ministry responded by withdrawing the book, with controversial parts to be struck off in a new edition to be rolled out later this year.

“For us, the topic of sexuality is important and should continue to be addressed,” said Education Ministry spokeswoman Gina Guibunda

She said that sex education will continue to be taught but “in a way that does not create problems in society”.

A section of the book taught to children aged between 12 and 13 reads “sometimes it is more comfortable to have a relationship with someone of the same sex. It is called a homosexual relationship.”

Homosexuality is taboo in many African countries including Malawi and is an offense that attracts huge penalties.