The nonadiabatic deactivation of trans-azomethane starting from the nπ* state has been investigated in gas phase, water, and n-hexane using an on-the-fly surface-hopping method. A quantum mechanical/molecular mechanics (QM/MM) approach was used employing a flexible quantum chemical level for the description of electronically excited states and bond dissociation (generalized valence bond perfect-pairing complete active space). The solvent effect on the lifetime and structural parameters of azomethane was investigated in detail. The calculations show that the nonadiabatic deactivation is characterized by a CNNC torsion, mainly impeded by mechanic interaction with the solvent molecules. The similar characteristics of the dynamics in polar and nonpolar solvent indicate that solvent effects based on electrostatic interactions do not play a major role. Lifetimes increase by about 20 fs for both solvents with respect to the 113 fs found for the gas phase. The present subpicosecond dynamics also nicely show an example of the suppression of C-N dissociation by the solvent cage.