Terrorist attacks can have profound consequences for the erosion of social norms, yet the causes of this erosion are not well understood. We argue that these attacks create substantial uncertainty about whether norms of civic conversation still hold. Observing breaches of these norms then leads people to express their own anti-immigrant attitudes more readily, as compared to a context where these norms are unambiguous. To test our theory, we examine (i) the impact of terrorist attacks on the level of hate speech against refugees in online discussions, and (ii) how the effect of terrorist attacks depends on the uncertainty about social norms of prejudice expression. To this end, we report on the results of a unique combination of a natural and a lab-in-the-field experiment. We exploit the occurrence of two consecutive Islamist terrorist attacks in Germany, the Würzburg and Ansbach attacks, in July 2016. Hateful comments towards refugees in an experimental online forum, but not towards other minority groups (i.e., gender rights), increased as a result of the attacks. The experiment compares the effect of the terrorist attacks in contexts where a descriptive norm against the use of hate speech is emphasized, i.e., participants observe only neutral or positive comments towards a minority group, to contexts in which the norm is ambiguous because participants observe anti-minority comments. Observing anti-immigrant comments had a considerable impact on our participants' own comments after the attacks, while observing anti-gender-rights comments did not. We end by discussing implications of the findings for the literature on social norms, sociological methods and policy.