Could a magnetars magnetic field have saved Mars atmosphere?

Just wondering: if a magnetar was close enough to Mars would it have saved its atmosphere by protecting it from solar radiation? I was wondering this because Earth protects us via a magnetic field; the magnetar would be providing Mars one. This is if it did not destroy the planet first as suggested here.

Edit I meant if the magnetar was safe to live by.

How would you get a magnetar close to Mars, within the solar system?

OK, let's leave that to one side, but the Earth's magnetic field is of order $10^{-4}$ Tesla at strongest. As the dipole field of a magnetar diminishes as $r^{-3}$ and could be as high as $10^{11}$ Teslas at the surface of the magnetar, at a radius of 10 km, then the magnetar woud need to be at a distance of $10^{6}$ km to surround Mars with a field of $10^{-4}$ Tesla.

The problem is that the radiation coming from the magnetar in the form of charged particles accelerated from the magnetic poles would completely dwarf the charged particle radiation from the Sun at Mars.

So no, a nearby Magnetar would not save Mars' atmosphere - quite the reverse.

EDIT: A BOTE calculations: If we look at the Crab pulsar - not quite a magnetar, but close - it is calculated that 10% of the rotational KE being lost ends up in synchrotron raiation from charged particles. That's about $10^{30}$ Watts. So there is at least $\sim 10^4$ solar luminosities, just in the kinetic energy of relativistic particles.

Magnetars are also very strong and variable sources of hard X-ray and Gamma ray radiation. Typical magnetar bursts/flares can release $10^{7}-10^{9}$ solar luminosities of hard X-rays and Gamma rays over periods of 1-40 s. That should fry any atmosphere (or anything else) that was only $10^{6}$ km away!

• Ask not how close you can move a magnetar to Mars - ask how close you can move Mars to a magnetar. In all seriousness, though - and this is just a somewhat unrelated question - how close to/far away from Mars would the magnetar have to be for its radiation to be equal to that of the Sun? – HDE 226868 Feb 21 '15 at 21:01