Cooperation among militant organizations contributes to capability but also presents security risks. This is particularly the case when organizations face substantial repression from the state. As a consequence, for cooperation to emerge and persist when it is most valuable, militant groups must have means of committing to cooperation even when the incentives to defect are high. We posit that shared ideology plays this role by providing community monitoring, authority structures, trust, and transnational networks. We test this theory using new, expansive, time-series data on relationships between militant organizations from 1950 to 2016, which we introduce here. We find that when groups share an ideology, and especially a religion, they are more likely to sustain material cooperation in the face of state repression. These findings contextualize and expand upon research demonstrating that connections between violent nonstate actors strongly shape their tactical and strategic behavior.