Previous research has investigated the effects of violence and warfare on individuals' well-being, mental health, and individual prosociality and risk aversion. This study establishes the short- and long-term effects of exposure to violence on short-term memory and aspects of cognitive control. Short-term memory is the ability to store information. Cognitive control is the capacity to exert inhibition, working memory, and cognitive flexibility. Both have been shown to affect positively individual well-being and societal development. We sampled Colombian civilians who were exposed either to urban violence or to warfare more than a decade earlier. We assessed exposure to violence through either the urban district-level homicide rate or self-reported measures. Before undertaking cognitive tests, a randomly selected subset of our sample was asked to recall emotions of anxiety and fear connected to experiences of violence, whereas the rest recalled joyful or emotionally neutral experiences. We found that higher exposure to violence was associated with lower short-term memory abilities and lower cognitive control in the group recalling experiences of violence, whereas it had no effect in the other group. This finding demonstrates that exposure to violence, even if a decade earlier, can hamper cognitive functions, but only among individuals actively recalling emotional states linked with such experiences. A laboratory experiment conducted in Germany aimed to separate the effect of recalling violent events from the effect of emotions of fear and anxiety. Both factors had significant negative effects on cognitive functions and appeared to be independent from each other.