Interplay between magnetism and superconductivity