  The magnetic activity of a star -- which modulates the stellar wind outflow
-- shapes the immediate environments of orbiting planets and induces
atmospheric loss thereby impacting their habitability. We perform a detailed
parameter space study using three dimensional magnetohydrodynamic simulations
to understand the effect of changing stellar wind magnetic field and planetary
magnetic field strengths on planetary magnetospheric topology and atmospheric
losses. It is observed that the relative strengths of stellar and planetary
magnetic fields play a significant role in determining the steady state
magnetospheric configuration and atmospheric erosion. When the stellar field is
strengthened or the planetary field is weakened, stellar magnetic field
accumulation occurs at the day-side of the planet which forces the magnetopause
to shift closer to its surface. The magnetotail opens up leading to the
formation of Alfv\'{e}n wings in the night-side wake region. We demonstrate how
reconnection processes and wind conditions lead to the bifurcation of the
magnetotail current sheet. With increasing stellar wind magnetic field
strength, the day-side reconnection point approaches the planet thereby
enhancing mass loss. We establish an analytic equation which successfully
captures the modeled mass-loss rate variations of planets with changing
magnetic field strengths. Our results are relevant for understanding how the
interplay of stellar and planetary magnetism influence (exo)planetary
environments and their habitability in star-planet systems with differing
relative magnetic field strengths, or in a single star-planet system over the
course of their evolution with age.
