Individuals benefit from maintaining the well-being of their social groups and helping their groups to survive threats such as intergroup competition, harsh environments and epidemics. Correspondingly, much research shows that groups cooperate more when competing against other groups. However, ‘social’ threats (i.e. outgroups) should elicit stronger cooperation than ‘asocial’ threats (e.g. environments, diseases) because (a) social losses involve a competitor's gain and (b) a strong cooperative reaction to defend the group may deter future outgroup threats. We tested this prediction in a multiround public goods game where groups faced periodic risks of failure (i.e. loss of earnings) which could be overcome by sufficient cooperation. This threat of failure was framed as either a social threat (intergroup competition) or an asocial threat (harsh environment). We find that cooperation was higher in response to social threats than asocial threats. We also examined participants’ willingness to manipulate apparent threats to the group: participants raised the perceived threat level similarly for social and asocial threats, but high-ranking participants increased the appearance of social threats more than low-ranking participants did. These results show that people treat social threats differently than asocial threats, and support previous work on leaders’ willingness to manipulate perceived threats.