Tunisia's Islamist government has turned against the radical Ansar al-Sharia group. I think it is a healthy sign.

Last week, the government banned Ansar from holding an annual conference to which the group had hoped to attract tens of thousands of followers from around the region. On Sunday, when the Salafists tried to meet in defiance of the ban, the police intervened aggressively, and a protester was killed. Ansar's spokesman was arrested (its leader was already in hiding), and Prime Minister Ali Laraydeh, for the first time, said the group "has ties to and is involved in terrorism."

Tunisia's many secularists have long accused the government of being in cahoots with Ansar, even though it has been blamed for attacks on art galleries, religious shrines, bars and other targets that Salafists see as insufficiently religious.

The suspicion of collusion was amplified after Rachid Ghannouchi, who heads the Ennahda Islamist group that leads the government, was filmed giving what appeared to be a lecture on strategy to the Salafists, advising them to play a long game to secure their goals.

The perception of close ties became less tenable after a Libyan offshoot of Ansar was suspected of leading the September attack on the U.S. diplomatic mission in Benghazi that killed U.S. Ambassador Chris Stevens and three other Americans. Tunisia's Ansar was suspected of an attack on the U.S. Embassy in Tunis a few days later.

Within Tunisia, the links became a political threat to Ennahda in February, after suspected Islamist extremists (though not necessarily belonging to Ansar), assassinated a prominent secularist opposition leader, Chukri Beleid. Hundreds of thousands of Tunisians protested, and the prime minister eventually resigned.

By March, the strains between Ennahda and the Salafists erupted openly. Ansar's leader, Seifallah ben Hassine (known as Abu Iyad), threatened that his group would overthrow the government if authorities applied pressure. Fortunately, Ennahda didn't buckle.

Ansar remains a delicate problem for the Ennahda. The Salafist group is believed to have supplied one of the largest contingents of jihadists fighting the regime of Bashar al-Assad in Syria. But it has publicly renounced the use of violence within Tunisia, which it has declared a land for Dawa, or proselytizing, rather than jihad.

That always was a questionable claim. Ansar's Abu Iyad co-founded the Tunisian Combatant Group, an organization linked to al-Qaeda. His two top lieutenants were arrested in connection with terrorist plots in Italy and identified by the U.S. State Department as al-Qaeda operatives. They were deported to Tunisia, jailed, and released after the 2011 revolution. And Ansar Facebook accounts have tracked acts of violence in Tunisia.

Tunisia's future is hopeful but complicated. A stable society has to include Ennahda and Salafists who eschew jihad. But it can't include a jihadist group that sends fighters abroad who may later return home with combat training; conducts a campaign of violence designed to intimidate the secular half of the population, threatens violence against the government, attacks foreign diplomatic missions and openly expresses its allegiance to al-Qaeda.

The government may now find it has to fight a terrorist campaign by Ansar. That may have been inevitable. The alternative would be to tolerate a state that concedes to the group's brutal agenda. Ennahda made the right choice.

(Marc Champion is a member of Bloomberg View's editorial board. Follow him on Twitter.)