Abstract Reproductive activities often increase the susceptibility of individuals to predators. Individuals may be able to reduce this risk of predation, however, by their choice of breeding habitat, as the structural complexity of habitats is known to affect predator foraging success. Here we show that the presence of predators induces a preference for structurally complex nest sites over open ones in male three-spined sticklebacks, Gasterosteus aculeatus. To investigate whether this predator-induced nest site preference can decrease the known negative effect of predators on courtship activity, we recorded the reduction in courtship activity during predator presentations for males in vegetated and open nest sites. Habitat structure affected the response to a predator when males were in competition. A male in a vegetated site reduced courtship activity less than a male in an open site. Habitat had no effect on courtship when males were solitary, however. This suggests that male–male competition and the possibility of losing mating opportunities to other males affect risk taking. Females, who were unaware of the predator, preferred the male in the vegetated site, which showed less reduction in courtship, when the males were exposed to a predator, but chose randomly between the males when the predator was absent. Thus, a preference for vegetated nest sites under predation risk may be beneficial not only by increasing the probability of survival, but also by reducing the negative impact of predators on courtship activity and mating probability.