Everyone wants clean air, peace and other public goods but is tempted to freeride on others’ efforts. The usual way out of this dilemma is to impose norms, maintain reputations and incentivize individuals to contribute. In situations of high uncertainty, however, such as confrontations of protesters with a dictatorial regime, the usual measures are not feasible, but cooperation can be achieved nevertheless. We use an Ising model with asymmetric spins that represent cooperation and defection to show numerically how public goods can be realized. Under uncertainty, people use the heuristic of conformity. The turmoil of a confrontation causes some individuals to cooperate accidentally, and at a critical level of turmoil, they entail a cascade of cooperation. This critical level is much lower in small networks.