Iranian President Ebrahim Raisi has ordered an investigation into the death of a young woman who was arrested by the country's "morality police" for wearing an inappropriate headscarf.

Police say 22-year-old Mahsa Amini died in custody from a "heart attack", though this has been challenged by relatives, witnesses and activists who accused police of violently beating her.

The incident has prompted a huge outcry in Iran, where the government's Islamic policies around dress codes are deeply unpopular among a large section of society.

According to reports on social media, Mahsa Amini, 22, was detained earlier this week by the so-called “morality police” after officers apparently found fault with her headscarf, or hijab.

The headscarf has been compulsory for women in Iran since after the 1979 Islamic Revolution and members of the morality police enforce the strict dress code.

Human rights activists who have spoken to the family say officers manhandled Amini and forced her inside a police van, according to IranWire.

Amini’s case has drawn condemnation from Iranian celebrities, athletes and other public figures.

Her brother, Kiarash, tried to intervene, but was told his sister was being taken to the police station for one hour of "re-education," IranWire reported. He said he never saw his sister awake again.