Terrorism often seeks to impact democratic politics. This article explores how it can influence the electoral fortunes of the incumbent. Existing research is contradictory. Models of retrospective voting predict a negative impact, as terrorism is detrimental to voters' welfare. However, the well-known ‘rally around the flag’ effect suggests otherwise: following a terrorist attack, voters often cling to the incumbent. We reconcile these arguments and argue that while both effects can coexist, the retrospective assessment is more durable than the rally around the flag. Using data on all deadly domestic terrorist attacks in Spain between 1977 and 2008, matched with municipal-level national election results, we show how exposure to strikes that occur during the last quarter of the term benefit the incumbent, while more temporally distant attacks are electorally harmful. In line with our theory, we find a more pronounced temporal heterogeneity for indiscriminate attacks and those that target civilians.