Homogeneous abundances of light elements, a-elements, and Fe-group elements from high-resolution FLAMES spectra are presented for 76 red giant stars in NGC 6715 (M 54), a massive globular cluster (GC) lying in the nucleus of the Sagittarius dwarf galaxy. We also derived detailed abundances for 27 red giants belonging to the Sgr nucleus. Our abundances measure the intrinsic metallicity dispersion (∼0.19 dex, rms scatter) of M 54, with the bulk of stars peaking at [Fe/H] ∼ -1.6 and a long tail extending to higher metallicities, similar to w Cen. The spread in these probable nuclear star clusters exceeds those of most GCs: these massive clusters are located in a region intermediate between normal GCs and dwarf galaxies. The GC M 54 exibits a Na-O anticorrelation, a typical signature of GCs, which is instead absent for the Sgr nucleus. The light elements (Mg, Al, Si) participating in the high temperature Mg-Al cycle show that the entire pattern of (anti)correlations produced by proton-capture reactions in H-burning is clearly different between the most metal-rich and most metal-poor components in the two most massive GCs in the Galaxy, confirming early results based on the Na-O anticorrelation. As in . Cen, stars affected by most extreme processing, i.e. showing the signature of more massive polluters, are those of the metal-rich component. These observations can be understood if the burst of star formation giving birth to the metal-rich component was delayed by as much as 10-30 Myr with respect to the metal-poor one. The evolution of these massive GCs can be easily reconciled in the general scenario for the formation of GCs sketched previously by ourselves, taking into account that w Cen may have already incorporated the surrounding nucleus of its progenitor and lost the remainder of the hosting galaxy while the two are still observable as distinct components in M 54 and the surrounding field.