We investigate whether the stock of foreigners residing in a country leads to a larger number of terrorist attacks on that country. Our instrument for the stock of foreigners relies on the interaction of two sets of variables. Variation across host-origin-dyads results from structural characteristics between the country of origin and the host, while variation over time makes use of changes in push and pull factors between host and origin countries resulting from natural disasters. Controlling for the levels of these variables themselves and fixed effects for dyads and years, the interaction provides a powerful and excludable instrument. Using data for 20 OECD host countries and 187 countries of origin over the 1980-2010 period we show that the probability of a terrorist attack increases with a larger number of foreigners living in a country. However, this scale effect is not larger than the effect domestic populations have on domestic terror. We find some evidence that terror is systematically imported from countries with large Muslim populations. A larger number of attacks against foreigners in the host country increases the risk of terror from foreigners there. We find that host country policies relating to integration and the rights of foreigners are key to fight terror – stricter policies that exclude foreigners already living in a country increase the risk of terror. High-skilled migrants are associated with a significantly lower risk of terror compared to low-skilled ones, while there is no significant difference between male and female migrants.