In any business transformation project there is a tipping point after which you can no longer put the genie back in the bottle. For better or for worse, immigration is a business transformation project. Think back to the turn of the 19th to 20th century. I expect that the then primary white cultures, English Scots and French were not pleased with the masses of Germans, Ukrainians, Italians, Poles and Russians entering by the boatload. Hell, in the 1960s we were still making disparaging jokes about Italians and Poles in Toronto.
As Europe's economies got better, less and less of the "masses" from there decreased, Canada had to look to other parts of the world. Ignoring the altruistic desires by some political parties for a multicultural society, it was the need to grow the population and the readily available desirable classes of immigrants from the third world that fulfilled that need.
The big difference that came with that is that while most of the European immigrants, like me, that arrived mostly wanted to integrate fully into the existing Canadian society. Being European made that easier (but not entirely easy - see Poles and Italians above). The newer crop that has come in over the last half century or so are more inclined to keep their cultural distinctions alive. The reasons for that are varied but religion, visible distinctions and deeply engrained cultural backgrounds have a lot to do with that.
Canada and America have always had to deal with not being a homogenous society and have had to deal with some radical elements within the immigrant group - think of support for the IRA; or communists fighting in Spain; or the FLQ; even the American revolution and Civil war have a cultural aspect to them.
I certainly have no answer as to how to stop violence as I think there will always be components of a "free and democratic society" who will turn to violence when their particular message is not accepted by the general public. One can absorb those acts and deal with them within the existing policing system. I'm actually more worried about how easy it is to manipulate the social media to influence large masses of all stripes into accepting false narratives. Once the masses are won over, critical analysis of the second and third order effects of a course of action is drowned out. While many focus on immigrants as a problem, the problem goes well beyond that into differences as to how the political structure of a country should work in order to benefit a given faction. This Transends mere cultural backgrounds. Currently, the flames of those differences are being fanned from inside and outside the country and will lead to more explosive violent acts then issues relating to some distant land.