Don't fool yourself: terrorism by a few religious loonies as a problem has been and will be a drop in the ocean.
The real issues are: how we organize work and social security in the global knowledge economy? How we deal with the climate change? How we deal with info ops, which is already much more destabilizing problem for western democracies than terrorism. You are right that migration is tough challenge, how we will handle increasing migration?