It is late afternoon; the light is softening and young people have gathered at the harbour in Banda Aceh to play music, buy an ice cream and just hang out. Suddenly the tranquillity of the scene is shattered when two black pick-ups arrive and discharge a dozen men and women in olive uniforms.

The officers approach a couple sitting in the shade. One says: "We're here to enforce local regulation 14. Are you married?" Shamefaced, the boy and girl shake their heads. The officers examine their identity papers, then order them to leave. The couple ride off on their motorbike, flushed with embarrassment.

It's all in a day's work for the Wilayatul Hisbah, a special unit established to enforce sharia in the staunchly Muslim province of Aceh, on the western tip of Indonesia's Sumatra island. The unit patrols several times a day, looking out for people drinking alcohol, gambling, unmarried couples, and women wearing tight clothes or not wearing an Islamic headscarf, a jilbab.

Download the new Independent Premium app Sharing the full story, not just the headlines

Aceh – known as the "Veranda of Mecca" because Islam entered Indonesia there centuries ago – won the right to implement sharia law in 2001, after the province was granted semi-autonomy as part of efforts to end a decades-long separatist war. In recent years, the law has been enforced with increasing rigour, with dozens of public canings carried out.

In September the provincial parliament approved a new criminal code that includes a provision for adulterers to be stoned to death. The move was condemned by human rights groups, and has alarmed local businessmen, who fear it will harm Aceh's attempts to attract investment following the tsunami five years ago. The provincial governor, Irwandi Yusuf, has refused to sign the new code, so for now it remains in an uncomfortable limbo. That has not prevented the Wilayatul Hisbah, sometimes compared with Saudi Arabia's notorious "vice and virtue" police, from pursuing their task with zeal. And Aceh is not alone. Across Indonesia, the world's most populous Muslim nation, dozens of local governments – given wide scope to enact their own laws under a decentralised system – have adopted Islamic regulations on dress and behaviour.

The trend threatens to undermine Indonesia's reputation for fostering a moderate brand of Islam, yet the creeping fundamentalism is not widely endorsed. At elections earlier this year, support for Islamic parties plummeted, at national level and also in Aceh. Many Acehnese abhor the stoning penalty, although few are prepared to criticise it publicly for fear of being labelled bad Muslims.

Observers say a radical Islamist minority is being allowed to hijack the agenda, and in Aceh that minority is certainly making headway. In October, clerics denounced an Acehnese woman who failed to wear a jilbab while competing in a national beauty pageant. From 1 January, tight trousers will be banned in one district.

Iskandar, head of the Wilayatul Hisbah, or "Wi-Ha", as it is known colloquially, applauds such measures. "In our religion, it's forbidden to wear tight clothes, because they can show the body shape and arouse men's desire to do things with women," he explains. "It's all about protecting women and increasing respect for them. Before sharia law, women were dressing impolitely and getting pregnant outside marriage. That has all decreased now."

At Wi-Ha's dilapidated headquarters in central Banda Aceh, Iskandar is in charge of 62 officers, including 16 women. "Right now three of them are pregnant," he confides, adding hastily: "All are married, of course."

For the dusk patrol, six women and six men set off in the two vehicles, men in front, women following. They cruise slowly towards the harbour, then suddenly veer off sharply to the right. Two young couples have been spotted behaving suspiciously.

Daily coronavirus briefing No hype, just the advice and analysis you need Enter your email address Continue Continue Please enter an email address Email address is invalid Fill out this field Email address is invalid Email already exists. Log in to update your newsletter preferences Register with your social account or click here to log in I would like to receive morning headlines Monday - Friday plus breaking news alerts by email Update newsletter preferences

It turns out that they are just sitting together in a public place. But Kuzri, the patrol leader, gives them a stiff warning nonetheless. "It's preventative action, to make sure nothing else happens," he says. "We told them that to be together in a romantic way if not married can be dangerous and is actually forbidden. It can lead to bigger things, and on to adultery." ("Adultery", in Aceh, means any kind of illicit sex.)

Further on, a girl and boy take off on a motorbike as soon as the sharia police arrive. "Actually we're brother and sister, but we were leaving anyway," says the boy. Another couple, who are fishing off some rocks, say they are married. Kuzri believes them. "You can tell whether people are married," he says. "First the location: married people don't need to find a secluded place to spend time with their spouses. Unmarried couples will try to find a place out of sight. Also, they sit next to each other, very close. People who are married don't do that."

It may seem semi-farcical, yet those who transgress the moral code can be caned, even if the stoning law has yet to be enacted. Critics say the code discriminates against women and poor people (since rich couples can go to a hotel), intrudes into private lives, encourages vigilantism and violates the Indonesian constitution. Iskandar receives about 20 anonymous tip-offs a day. A man is spotted going into a hair and beauty salon; he is suspected of visiting prostitutes. An unmarried couple are seen entering a house at 7pm and not leaving until dawn. "What do you think they were doing all that time?" asks Iskandar. He laughs. "Just sleeping or talking?"

But he insists that Aceh is "very different from Afghanistan", and says no one has been caned since he took over last year. "I prefer to give people advice, maybe call in their parents. I think caning is not a good solution." He leans forward conspiratorially. "Actually, I hate caning," he says.

While there is support for sharia, particularly in socially conservative rural areas, many Acehnese have reservations. Lindawati, a seamstress, says: "Women are dressing more modestly now, and there are fewer cases of adultery, which is good. But as for the stoning regulation, I don't know how I would feel if one of my family had to suffer that kind of punishment."

Back at the harbour, a woman selling barbecued sweetcorn by the roadside is displeased to see Kuzri's team. "To be honest, most people don't like the sharia police," she says. One of her customers, a young man, agrees. "I got a warning for being out with my girlfriend," he says. "It's annoying. We weren't doing anything wrong."

But the Wi-Ha is happy in its work. "There are two advantages of our job," says Herman. "We get to carry out our duties, and we also get blessed by God because we're strengthening Islam."