Critics of Tunisia's moderate Islamist government, led by the Ennahda party, have in the past chided it for being a soft touch with followers of the ultra-conservative Salafi movement, treating them like wide-eyed, wayward children with a well-intentioned but simplistic view of religion. But times have changed.

As a journalist based in Tunisia, I have watched relations between Salafists and Ennahda spectacularly crumple in recent weeks. This weekend was a turning point. Police clashed with the Salafi group Ansar al-Sharia in the central city of Kairouan and the Tunis suburb of Ettadhamen. The Salafists were trying to hold an annual conference without legal permission.

The damage was severe: one protester shot dead and 15 police injured. Tunisia's prime minister, Ali Larayedh, has, for the first time, linked Ansar al-Sharia to terrorism. There have now been confrontations three weekends running – first police dispersed Salafists who were trying to pitch preaching tents across Tunisia, and violence followed on the following weekends.

Ennahda's dramatically hardened attitude towards Salafists could be an attempt to claw back security credentials. Tunisia's army has failed to capture a spattering of jihadists, with links to al-Qaida, lurking on Tunisia's border with Algeria. A tough stance on Salafists, who many Tunisians suspect of dabbling in terrorism, is a tempting political strategy for Ennahda, now thirsty to prove to sceptics that it can be tough on terrorism.

But Ennahda's crackdown is missing a trick. Salafists have highly varying views and not all are dangerous. That includes Ansar al-Sharia members. Banning an annual conference and obstructing preachers could make Salafists who are against violence more tempted to use it out of frustration.

Ennahda should instead adopt a shrewder policy, making the distinction between three types of Salafists – scripturalist Salafists who are apolitical and only interested in proselytising; jihadist Salafists who are against using violence domestically (a group that includes some Ansar al-Sharia members); and jihadist Salafists who champion domestic terrorism. Ennahda should tolerate the first lot; pull the second lot into mainstream politics; and come down hard on the third group through targeted anti-terrorism operations.

Allowing scripturalist Salafists to preach on the streets is a no-brainer. Denying them the right is undemocratic and dangerously provocative. Dealing with jihadist Salafists is a stickier issue. There are many things about Ansar al-Sharia, for example, that are nauseating: members openly praise al-Qaida, and its leader has threatened to wage war on the government. Elements of the group have been blamed for an attack on the US embassy in Tunis last September.

And yet the organisation has nuances. Most members are injected with globules of jihadism. But a large strain are staunchly against waging jihad within Tunisia. Instead they favour militancy abroad – in Syria and Afghanistan.

The organisation peddles highly religious policies that leave a bitter taste in the mouths of westerners and secular Tunisians. But surprisingly thoughtful, if at times fanciful, theories underlie them. Take halal tourism. Ansar al-Sharia wants Tunisia to focus less on the traditional western tourist market and target a Muslim market, especially from Europe. Such a policy wouldn't be stupid: global interest in halal tourism is growing, with Muslim countries like Malaysia and Turkey already showing interest in developing models in their own countries. Ansar al-Sharia also supports Islamic trade unionism, financial reforms and tackling education inequality.

Many members of Ansar al-Sharia are enthusiastic about improving public services in their local neighbourhoods too. They run local services that the government isn't delivering in poor areas – like cleaning the streets, teaching, and resolving local disputes.

Ansar al-Sharia is thus partly made up of campaigners who instinctively want to craft policies and improve the lot of Tunisia's poor. That gives Ennahda something to work with. It should integrate these Salafists into mainstream politics. With a real stake in politics and a taste of what it means to negotiate for change, jihadist Salafists are more likely to moderate their views.

At the same time, the government should show no tolerance for jihadist Salafists that are involved in unprovoked violence. They must investigate Salafists suspected of terrorist links. Authorities need to clamp down on groups that use mosques as havens for arms and drugs smuggling too. And punish Salafists who target Tunisians they deem "un-Islamic" – like artists, liquor sellers and unveiled women.

Tunisian Salafism is a thick, murky soup of contrasting ideas and protagonists. But Ennahda must wade through it to decide who it can reason with and who it can't. If Ennahda simply turns up the heat, it will only scald itself.