There is no easy solution to the kind of problem that is happening in France and other nations in Europe.
On one hand, you have people who hate the culture of the country they are living in, so they join other like-minded people and commit acts of terrorism.
On the other hand, larger groups of people don't like the acts of terrorism happening in their country, nor do they particularly like the people who dress different, worship different and talk different than themselves. When some members of that other culture commit terrorist acts they blame the whole community which them creates more of the first group.
Part of the core problem is when people move into a country, but they don't want to become part of that country but rather form communities where they try to retain all of their culture and ways while still living in the other country. By rejecting everything of the people who already live in that country, they are creating an environment where they will be viewed differently and not necessarily positively and at the same time they are also creating an environment where there will be resentment going in both directions.
I think that there would be fewer problems if people moving into a country make more of an effort to become part of that country rather than trying to create enclaves of their own within that country. By accepting that they are part of that country and want to be a part of that country and community, there would be less friction on both sides. This doesn't mean giving up their religion and beliefs, but to also respect that there are positives of the country that they have moved into and to accept that they will have to change themselves to become part of that community and country.
My :2cents