Iranian police have arrested two women for riding a motorcycle in a western city — an incident that went viral when images appeared online and sparked a social-media backlash against the country's political and religious authorities.

State news agency IRNA said the two women were detained Sunday in Dezful, whose law enforcement chief, Ali Elhami, accused them of committing an "ugly" act that breaks the "religious norms" of the conservative Islamic-led nation.

IRNA quoted Elhami as saying he ordered the women's arrest after online images of the two women riding the motorcycle and being surrounded by male onlookers at a local park prompted complaints about the women's dress, appearance and interaction with the men. The women, who were not identified, were handed over to judicial authorities.

Women in Iran are barred from obtaining licenses to drive motorcycles in public.

Iranian investigative journalist Masih Alinejad, who hosts VOA Persian's TV program Tablet, shared images of the incident on her Facebook page and her Instagram account.

The 34-second video, apparently filmed by a witness with a mobile phone, shows two women riding a motorcycle on a street with a group of male motorcyclists riding behind them, while onlookers yell and whistle. After a few seconds, the video shows the women standing in the midst of a group of male motorcyclists who gesture at them and hold up their phones to take pictures. The women walk away from the men and the video stops.

What happened next is not clear from the posted video.

On Alinejad's Facebook page, some users criticized the male onlookers for shameful and harassing behavior. Others criticized the arrest of the female motorcyclists as part of what they see as Iran's oppression of women.

Ø¨ÙÙØ§Ø² Ø´ÙÛØ¹Û Ø¯Ø± Ø­Ø§Ù Ø¢Ù Ø§Ø¯Ù Ø´Ø¯Ù FILE - Iranian motocross rider Behnaz Shafiei, left, prepares for a training session at a racetrack near the village of Baraghan, west of the capital Tehran, June 5, 2015. FILE - Iranian motocross rider Behnaz Shafiei, left, prepares for a training session at a racetrack near the village of Baraghan, west of the capital Tehran, June 5, 2015.

Iran does not ban all women from motorcycle riding. Off-road motorcycle racer Behnaz Shafiei was among a group of women granted official permission to practice on off-road circuits in 2015. In March of that year, Iranian newspaper Jamejam published photos of her practicing. At the time, she also told The Guardian newspaper that she hoped to be allowed to compete in motocross competitions.