I am loath to disagree with you VE, as I feel it will just start another argument, but most of these atrocities are perpetrated by people who are either resident of the country where the atrocity is committed, or have easy access to it.
I don't know the background of the criminal of the Barcelona outrage. But there are millions of Muslims in Europe already, so stopping any further from coming in would seem like a case shutting the stable door, etc.
Like most people on here, and those in Authority, I don't know of any magic bullet for this current situation.