Malaysia's government will alter an elementary-school textbook which suggested girls should dress modestly to prevent sexual assault, authorities said Wednesday, after it sparked widespread anger.

Social media exploded with outrage after images circulated of a section of the book, which is used by nine-year-olds, entitled "Saving one's modesty".

It featured a series of pictures of a fictional girl called Amira, whose parents advise her to protect "the modesty of her sexual organs" by wearing the correct attire.

They also tell her to keep the door of her room closed when changing clothes, and to avoid spending time in quiet locations alone.

If she fails in her efforts to prevent an assault, Amira would bring shame on her family, be shunned by her friends and face emotional problems, the book said.

Activists said the book was teaching children from a young age that female victims of sex attacks only had themselves to blame.

"We are appalled," said Meera Samanther, vice president of rights group Women's Aid Organisation.

"The educational material sexualises nine-year-old girls, teaches them to be ashamed of their bodies, and shifts the blame from the perpetrator to the survivor of sexual assault."

Following the outcry, the education ministry said the controversial section of the book would be covered over using stickers.

It is not the first time authorities in Muslim-majority Malaysia have been accused of taking a poor approach to issues of gender or sexuality.

The health ministry was criticised in 2017 for offering cash prizes for the best videos explaining how to "prevent" homosexuality. The competition was amended following an outcry.