Here's a "fun" link for this.
This time you can look at "firepower" by country....
http://www.globalfirepower.com/countries-listing-middle-east.asp
You can even compare them..... UNREAL
http://www.globalfirepower.com/countries-comparison.asp
I have no idea if the stats on that site are...
And as if by magic....
http://www.independent.co.uk/news/world/middle-east/isis-a-year-of-the-caliphate-who-can-defeat-the-socalled-islamic-state--and-how-10351316.html
The home grown terrorist is not a new phenomena.
A very good comparison is European left wing terrorism throughout the last century (and continuing into this one).
Shutting borders won't stop it, because it's ideological not geographical.
That is different to fighting ISIS in a ground war...