The solution has to involve some sort of safe places for them in their own land along with support sand guidance so that they can maintain those safe zones on their own.
That happened, but, everything worked for was lost when the troops were pulled out (Iraq).
The general public is going to have to be comfortable with a prolonged presence in countries where safety can be achieved for the people. And that is not likely to happen. Not when politicians can use it as a tool.
Read recently that Jordan has been asking for help with between 700,000 to a million refugees they have taken in (reports conflicted so not sure what the realistic number is), and has received nothing substantial. Instead of giving Iran at least 400 million, why not give aid to Jordan?
Secondly, a general thought in regards to the thread as a whole, something I don't think people consider often is that the terrorist that does get through is not coming here to necessarily commit a terrorist act, but, to indoctrinate and recruit. Think about it: that is going to be a more effective means of advancing hostilities.
And I hate to say it, but many Americans are easily influenced and are easy targets.
That, in my opinion, is the real danger. Their teachers getting into the country. And I don't think there is really going to be any effective means of identifying those who intend to engage in efforts like that.
God bless.