Graphite and diamond have comparable free energies, yet forming diamond from graphite is far from easy. In the absence of a catalyst, pressures that are significantly higher than the equilibrium coexistence pressures are required to induce the graphite-to-diamond transition [1][2][3][4][5][6][7] . Furthermore, the formation of the metastable hexagonal polymorph of diamond instead of the more stable cubic diamond is favored at lower temperatures 2,5-7 . The concerted mechanism suggested in previous theoretical studies 8-12 cannot explain these phenomena. Using an ab initio quality neural-network potential 13 we performed a largescale study of the graphite-to-diamond transition assuming that it occurs via nucleation. The nucleation mechanism accounts for the observed phenomenology and reveals its microscopic origins. We demonstrated that the large lattice distortions that accompany the formation of the diamond nuclei inhibit the phase transition at low pressure and direct it towards the hexagonal diamond phase at higher pressure. The nucleation mechanism proposed in this work is an important step towards a better understanding of structural transformations in a wide range of complex systems such as amorphous carbon and carbon nanomaterials.Static compression of hexagonal graphite (HG) results in the formation of metastable hexagonal diamond (HD) at temperatures around 1200-1700 K 2,5-7 and cubic diamond (CD) at higher temperatures 1,[3][4][5]7 . Although the transition pressure is sensitive to the nature of the graphite samples neither of the diamond phases has been observed to form below ∼12 GPa. This pressure is significantly higher than the graphite-diamond coexistence pressure approximated by the Berman-Simon line P (GPa) ∼ 0.76 + 2.78 × 10 −3 T (K) 14 .Despite being an area of intense theoretical research 8-12 the microscopic mechanism of the formation of metastable HD and the reason for the remarkable stability of graphite above the coexistence pressure are still unknown. Computer simulations, which could help resolve these issues, have been hindered because of the inability of empirical potentials to describe the energetics of the transformation accurately 13,15 and the computational expense of more reliable ab initio methods. In the latter case, short simulation time and small system size (i.e. several hundred atoms) force the transition to occur in a concerted manner with the ultrafast (∼ 10 −2 − 1 ps) synchronous formation of all new chemical bonds accross the entire simulation box 11,12,16 . While concerted mechanisms can be observed at shock compression 16-18 , the transformation under static conditions is expected to proceed via nucleation and growth.It has been estimated that because diamond has an extremely high surface energy 19 its critical nuclei may contain thousands of atoms 20-22 . Hence, tens or even hundreds of thousands of atoms are required for modeling the diamond nuclei and the surrounding graphite matrix. Direct ab initio simulations of systems of this size are outright impossible. Ther...