Magnetars are compact stars which are observationally determined to have very strong surface magnetic fields of the order of 10 ^ { 14 } -10 ^ { 15 } G. The centre of the star can potentially have a magnetic field several orders of magnitude larger . We study the effect of the field on the mass and shape of such a star . In general , we assume a non-uniform magnetic field inside the star which varies with density . The magnetic energy and pressure as well as the metric are expanded as multipoles in spherical harmonics up to the quadrupole term . Solving the Einstein equations for the gravitational potential , one obtains the correction terms as functions of the magnetic field . Using a nonlinear model for the hadronic EoS the excess mass and change in equatorial radius of the star due to the magnetic field are quite significant if the surface field is 10 ^ { 15 } G and the central field is about 10 ^ { 18 } G. For a value of the central magnetic field strength of 1.75 \times 10 ^ { 18 } G , we find that both the excess mass and the equatorial radius of the star changes by about 3 - 4 \% compared to the spherical solution .