Process for preparation of polyoxymethylenes via polymerization of the monomers a) in the presence of cationic initiators b) and also, if appropriate, in the presence of regulators c), followed by deactivation and discharge from the reactor, which comprises using, as deactivator (d) at least one basic compound having at least 2 amino functions of different reactivity in one molecule.