The problem is that many of the people we are taking in are part of CIA themselves or are at least sympathizers. So they end up loving our countries up internally. There is no true solution to the problem in the middle east. Either people get killed and the war lasts longer, or more people get killed and the war ends quicker.
And yet the attack and Self Delete bomb in Europe, rape their women, act violent, demand Sharia no go zones...
This is a common argument for most anti-refugee people, and the only thing I can say about it is that there's not enough proof to actually determine that.
Of all the studies we've done in other countries that take in refugees, we've found that around 80% of them manage to be self-sufficient and get jobs, start business, and cause little to no problems. We've found that between 1-5% of them tend to re-exhibit radical tendancies, which is a really small amount.
In this case, saving half a million people but having two terrorist attacks that claim the lives of 20 people is a worthy tradeoff.
Also worth noting that most terrorist attacks in western civilization are caused by official citizens of said country, who were born on the soil of the country they are attacking.