Context. The Cepheid period-luminosity (PL) relation is unquestionably one of the most powerful tools at our disposal for determining the extragalactic distance scale. While significant progress has been made in the past few years towards its understanding and characterization both on the observational and theoretical sides, the debate on the influence that chemical composition may have on the PL relation is still unsettled. Aims. With the aim to assess the influence of the stellar iron content on the PL relation in the V and K bands, we have related the V-band and the K-band residuals from the standard PL relations of Freedman et al. (2001, ApJ, 553, 47) and Persson et al. (2004, AJ, 128, 2239, respectively, to [Fe/H]. Methods. We used direct measurements of the iron abundances of 68 Galactic and Magellanic Cepheids from FEROS and UVES high-resolution and high signal-to-noise spectra. Results. We find a mean iron abundance ([Fe/H]) about solar (σ = 0.10) for our Galactic sample (32 stars), ∼−0.33 dex (σ = 0.13) for the Large Magellanic Cloud (LMC) sample (22 stars) and ∼−0.75 dex (σ = 0.08) for the Small Magellanic Cloud (SMC) sample (14 stars). Our abundance measurements of the Magellanic Cepheids double the number of stars studied up to now at high resolution. The metallicity affects the V-band Cepheid PL relation and metal-rich Cepheids appear to be systematically fainter than metal-poor ones. These findings depend neither on the adopted distance scale for Galactic Cepheids nor on the adopted LMC distance modulus. Current data do not allow us to reach a firm conclusion concerning the metallicity dependence of the K-band PL relation. The new Galactic distances indicate a small effect, whereas the old ones support a marginal effect. Conclusions. Recent robust estimates of the LMC distance and current results indicate that the Cepheid PL relation is not Universal.