Controlling the magnetic anisotropy in ultrathin metallic films by