A perturbative solution of the transfer equations for the Stokes parameters in a magnetic field