Red phosphorus as a flame retardant for a thermoplastic nitrogen-containing polymer