Across and within societies, people vary in their propensities towards exploitative and retaliatory defection in potentially cooperative interaction. We hypothesized that this variation reflects adaptive responses to variation in cues during childhood that life will be harsh, unstable and short—cues that probabilistically indicate that it is in one's fitness interests to exploit co-operators and to retaliate quickly against defectors. Here, we show that childhood exposure to family neglect, conflict and violence, and to neighbourhood crime, were positively associated for men (but not women) with exploitation of an interaction partner and retaliatory defection after that partner began to defect. The associations between childhood environment and both forms of defection for men appeared to be mediated by participants' endorsement of a ‘code of honour’. These results suggest that individual differences in mutual benefit cooperation are not merely due to genetic noise, random developmental variation or the operation of domain-general cultural learning mechanisms, but rather, might reflect the adaptive calibration of social strategies to local social–ecological conditions.