A structural phase transition induced by an external magnetic field