DUBAI -- Protests broke out in western Iran on Saturday at the funeral of a young woman who died after being detained by morality police enforcing strict hijab rules, as security forces used tear gas to disperse demonstrators.

Videos posted on social media showed protesters shouting anti-government slogans after gathering in Saqez, hometown of Mahsa Amini, from nearby cities in Iran's Kurdistan province as they mourned the 22-year-old who died in a hospital in the capital Tehran on Friday.

"Death to the dictator" -- a reference to Supreme Leader Ayatollah Ali Khamenei, chanted the crowd, while some women took off their headscarves. Police were seen firing tear gas and one man was shown on a video with an injury to the head that someone could be heard saying was caused by birdshot. Reuters could not authenticate the videos.

In the past few months, rights activists have urged women to publicly remove their veils, a gesture that would risk their arrest for defying the Islamic dress code as the country's hardline rulers crack down on "immoral behaviour."

Videos posted on social media have shown cases of what appeared to be heavy-handed action by morality police units against women who had removed their hijab.

Protests spread later on Saturday to the provincial capital, Sanandaj, with social media videos showing crowds chanting "Saqez is not alone, it's supported by Sanandaj." Marchers were seen confronting riot police amid the sound of sporadic gunfire.

INVESTIGATION INTO DEATH

Authorities have launched probes into the death of Amini, but a medical examiner said on Saturday results of forensic tests may take three weeks. Interior Minister Abdolreza Rahmani Fazli told state TV there was no report she was beaten.

Police said Amini was taken ill as she waited together with other detained women at a morality police station, rejecting allegations on social media that she was likely beaten.

Police released closed-circuit television footage apparently supporting their version of events. Reuters could not authenticate the video, which appeared to have been edited.

Police earlier said Amini had suffered a heart attack after being taken to the station to be "educated." Her relatives have denied she suffered any heart condition.

Prominent sports and arts figures posted critical social media comments about Amini's death and protests were held in Tehran on Friday amid a heavy presence of riot police.

As during past protests, authorities appeared to have restricted mobile internet access in Saqez and nearby areas, social media posts said.

Internet blockage observatory NetBlocks reported "a significant internet outage" in Tehran on Friday, linking it to the protests.

Under Iran's sharia, or Islamic law, imposed after the 1979 revolution, women are obliged to cover their hair and wear long, loose-fitting clothes to disguise their figures. Violators face public rebuke, fines or arrest.

Decades after the revolution, clerical rulers still struggle to enforce the law, with many women of all ages and backgrounds wearing tight-fitting, thigh-length coats and brightly coloured scarves pushed back to expose plenty of hair.

(Reporting by Dubai newsroom; Editing by Alex Richardson)