Three-hundred and forty-five herds (17 swine, 122 dairy sheep, 124 beef and 82 dairy cattle) were investigated for prevalence of Shiga toxin-producing Escherichia coli (STEC). Rectal faecal samples were selectively enriched and then examined by immunodetection techniques (Immunomagnetic Separation with anti-E. coli O157 Dynabeads, ImmunoMagnetic cell Separation (IMS) and automated enzyme-linked fluorescent immunoassay using VIDAS) and polymerase chain reaction (PCR) (rfbE and fliC genes) to assess the prevalence of E. coli O157:H7. Prevalence of non-O157 STEC was estimated by PCR screening for stx genes of 10 lactose-positive colonies grown on MacConkey agar after enrichment. PCR was used on all STEC isolates to detect stx1, stx2, eaeA and E-hlyA genes. Both immunodetection methods showed a moderate–good level of agreement (κ = 0.649) but IMS showed 87.5% complementary sensitivity. Prevalence of positive herds for E. coli O157:H7 was estimated at 8.7% for sheep and 3.8% for cattle, whereas all the porcine herds tested negative. Non-O157 STEC were also absent from swine, but were isolated more frequently from ovine (50.8%) than bovine herds (35.9%). Within-herd prevalences of excretion of E. coli O157:H7 established by individual testing of 279 sheep (six herds) and 30 beef cattle (one herd) were 7.3% and 6.7% respectively. PCR analysis of 49 E. coli O157:H7 and 209 non-O157 isolates showed a different distribution of virulence genes. All E. coli O157:H7 were stx2 gene-positive, eaeA was detected in 95.9%, and the toxigenic profile stx2/eaeA/E-hlyA was present in 75.5% of the isolates. Among the non-O157 STEC, prevalence of eaeA was significantly lower (5.3%) and E-hlyA was present in 50.2% of the isolates but only sporadically associated with eaeA. stx2 was predominant in non-O157 isolates from cattle, whereas in sheep the combination stx1/stx2 was more prevalent. This study demonstrated the wide distribution of STEC in ruminant herds, which represent an important reservoir for strains that pose a potential risk for human infections.