The role of the solvent and the influence of dynamics on the kinetics and mechanism of the SNAr reaction of several halonitrobenzenes in liquid ammonia, using both static calculations and dynamic ab initio molecular dynamics simulations, are investigated. A combination of metadynamics and committor analysis methods reveals how this reaction can change from a concerted, one-step mechanism in gas phase to a stepwise pathway, involving a metastable Meisenheimer complex, in liquid ammonia. This clearly establishes, among others, the important role of the solvent and highlights the fact that accurately treating solvation is of crucial importance to correctly unravel the reaction mechanism. It is indeed shown that H-bond formation of the reacting NH3 with the solvent drastically reduces the barrier of NH3 addition. The halide elimination step, however, is greatly facilitated by proton transfer from the reacting NH3 to the solvent. Furthermore, the free energy surface strongly depends on the halide substituent and the number of electron-withdrawing nitro substituents.