A strain of E.coli became a potentially fatal infection in the UK around 30 years ago when it acquired a powerful toxin, according to genetic research.

Scientists said their findings help to explain outbreaks of severe food poisoning which began in the 1980s.

And they warned that E.coli O157 is continuing to evolve and should be monitored closely.

Most strains of E.coli are harmless and live in the guts of people and animals without causing illness.

But E.coli O157 strains can produce molecules called shiga-toxins, which are linked to more serious human infections.

The strains responsible for the majority of serious illness in people in the UK produce two types of shiga-toxin, known as stx1 and stx2a, scientists said.

A team of researchers, including scientists from the University of Edinburgh and Public Health England, decoded the genetic sequences of more than 1,000 samples of E.coli O157 collected from human infections and animals over the past three decades.

They found most of the ancestor strains of E.coli O157 carry only stx1, but some strains began to acquire stx2a around 60 years ago.

The dangerous strains of E.coli O157 which have caused most illness in people in the UK acquired stx2a around three decades ago, when outbreaks of severe food poisoning began to appear, the research team found.

They also noted that some more recent infections are being caused by E.coli O157 strains that carry only stx2a, with early evidence suggesting these strains may be even more dangerous.

Although they show no signs of the disease, cows are the main reservoir of E.coli O157 and animals infected with strains that produce stx2a excrete higher levels of dangerous bacteria in their manure.

Professor David Gally, of the University of Edinburgh's Roslin Institute, said: "Thankfully, dangerous E.coli outbreaks remain relatively rare. Our research underlines the need to study the genetic code of strains that cause infections in humans and those present in farmed animals.

"Good hygiene practices - both with food and when out enjoying the countryside - can help to minimise the risk of these and other severe infections. Our work endeavours to understand how these toxic strains persist in cattle and the best ways to prevent them spreading to us."

The research - published in the Microbiology Society's journal Microbial Genomics - was also conducted by the Animal Laboratories and Plant Health Agency, the Scottish E.coli Reference Laboratory, Scotland's Rural College and the University of East Anglia.