The deadly attack in Paris on a satirical magazine that had published cartoons on Islam drew outrage from European leaders and presented them with a delicate task: keeping the tragedy from exacerbating tensions over Muslim immigration across the region.

German Chancellor Angela Merkel said the attack was “despicable” and “an attack on freedom of speech and the press, which are a core element of our free democratic culture.” U.K. Prime Minister David Cameron called the attack barbaric and promised his country would “stand squarely...