A process for preparing nitrogen-containing heterocyclic compounds that are chloro or bromo substituted at a ring position adjacent to the ring nitrogen atom which comprises reacting a hydroxy-substituted starting material with the kinetic form of a triphenylphosphite-halogen complex.