The girl fell ill during a visit to Mora in central Sweden last Sunday. She died a few days later. The source of the infection is not yet known.
Enterohaemorrhagic E. coli (EHEC) is an intestinal bacterium primarily found in the saliva and bodily waste of cattle, sheep and goats but infections can also be transmitted from person to person and via food.
Since children often enjoy stroking animals, they are also more prone to infection, although the two-year-old was not known to have been in recent contact with any animals.
Common symptoms of the diseases caused by EHEC include abdominal cramps and diarrhoea that may in some cases progress to bloody diarrhoea, according to the World Health Organization.
The Swedish Institute for Infectious Disease Control (Smittskyddsinstitutet) said it had received around 100 reports of EHEC infections so far this year, which it said was a normal figure. Infections are most common during the summer.
The last time a person died in Sweden after being infected with the bacteria was in 2005. That too was an isolated case that did not result in an epidemic, said Smittskyddsinstitutet in a statement.
The best ways of protecting against EHEC infection are to eat meat that is well cooked, avoid unpasteurized dairy products, wash vegetables well, and wash hands following any contact with animals.