Impact of nonequilibrium phonons on the electron dynamics in terahertz quantum cascade lasers