A criterion for the onset of deformation twinning (DT) is derived within the Peierls framework for dislocation emission from a crack tip due to Rice (J. Mech. Phys. Solids 40(2) (1992) 239). The critical stress intensity factor (SIF) is obtained for nucleation of a two-layer microtwin, which is taken to be a precursor to DT. The nucleation of the microtwin is controlled by the unstable twinning energy γ u t , a new material parameter identified in the analysis. γ u t plays the same role for DT as γ u s , the unstable stacking energy introduced by Rice, plays for dislocation emission. The competition between dislocation emission and DT at the crack tip is quantified by the twinning tendency T defined as the ratio of the critical SIFs for dislocation nucleation and microtwin formation. DT is predicted when T>1 and dislocation emission when T<1. For the case where the external loading is proportional to a single load parameter, T is proportional to γ u s /γ u t . The predictions of the criterion are compared with atomistic simulations for aluminum of Hai and Tadmor (Acta Mater. 51 (2003) 117) for a number of different crack configurations and loading modes. The criterion is found to be qualitatively exact for all cases, predicting the correct deformation mode and activated slip system. Quantitatively, the accuracy of the predicted nucleation loads varies from 5% to 56%. The sources of error are known and may be reduced by appropriate extensions to the model.