The Magnetosphere as a ProtectorThe sun forces a planetary magnetic field to become a magnetosphere. As the sun pushes the magnetic field back into a tear drop shape, the sun's particles keep flowing past the planet. Most particles don't hit the planet directly and so we can think of the magnetosphere as a planetary protector from the Sun's potentially harmful particles.
A magnetosphere helps protect a planet from the solar wind, however, the Martian magnetosphere may be too small and weak to do that very well. In this picture, MGS can be seen orbiting Mars within the magnetosphere.
The magnetosphere is considered to be the last region of the planet under the influence of the planets gravity and magnetic field, not including the planet's moons. Outside the magnetosphere, the regions of influence of the planet stop. Thus the magnetosphere can be found outside of, but somewhat overlapping the planet's atmosphere. Particles of the atmosphere can sometimes enter the magnetosphere and particles of the magnetosphere can sometimes enter the atmosphere.