Politicians and pundits united in condemning what they saw as an attempt to stifle free speech in a country that, in 2006, faced violent rage across the Muslim world over a newspaper’s cartoons of the Prophet Muhammad. Since then, the newspaper that first printed the images, Jyllands-Posten, has been the target of several terrorist plots.

However, as Mr. Hedegaard’s own opinions, a stew of anti-Muslim bile and conspiracy-laden forecasts of a coming civil war, came into focus, Denmark’s unity in the face of violence began to dissolve into familiar squabbles over immigration, hate speech and the causes of extremism.

But then something unusual happened. Muslim groups in the country, which were often criticized during the cartoon furor for not speaking out against violence and even deliberately fanning the flames, raised their voices to condemn the attack on Mr. Hedegaard and support his right to express his views, no matter how odious.

The writer, who for several years edited a mainstream Danish daily, Information, is a major figure in what a study last year by a British group, Hope Not Hate, identified as a global movement of “Islamophobic” writers, bloggers and activists whose “anti-Muslim rhetoric poisons the political discourse, sometimes with deadly effect.”

That Danish Muslims would rally to defend Mr. Hedegaard, a man they detest, suggests a significant shift in attitudes, or at least in strategies, by a people at the center of a European debate over whether immigrants from mostly poor Muslim lands can adjust to the values of their new and, thanks to a long economic crisis, increasingly wary and often inhospitable homes.