Stabilization of the Alfvén‐ion cyclotron instability in inhomogeneous media