Historians agree that the tale of the Pied Piper of Hamelin, recorded in the 19th century by Jakob and Wilhelm Grimm, is based on an actual occurrence in 1284 in which most of the children in Hamelin disappeared. However, no one knows for sure the exact reason for the disappearance. Many scenarios have been postulated, some more likely than others.
The story of the Pied Piper was first depicted in a stained glass window from about 1300. The earliest written account dates from the mid-15th century. The Grimm brothers' version from the 1800s is the one that most people are familiar with, and the folklorists drew on 11 different sources for their tale.
In the Grimm version of the story, the Pied Piper, also known as the Rattenfaenger, or rat catcher, appears in the town of Hamelin in the middle of a rat infestation and offers to rid the town of vermin. He uses an enchanted pipe to lure the rats into a river, where they all drown, but the townspeople refuse to pay him a shilling per rat, as promised. He leaves Hamelin, but returns a few weeks later to seek revenge. On his second visit to Hamelin, the Pied Piper uses his magic pipe on the children of the town, leading them into a hole in a mountain on the edge of town and sealing them inside. Only two children remain in the town, one blind and one lame, because they could not follow the piper.
Some suggest that the cause of the children's disappearance was an accident of an epidemic. These theories make sense of some of the elements of the Grimm brothers' version, as being sealed inside a mountain could refer to a major landslide, or the rats could be a reference to plague. However, the European Black Death epidemic did not begin until the 14th century, and rats do not appear in versions of the Pied Piper story before the late 16th century, so the plague theory is unlikely.
Another branch of the epidemic theory postulates that the children fell prey to some sort of disease that caused them to dance, such as Huntington's disease or another form of chorea. As Huntington's disease is a genetic disorder, however, it is not likely that all the children in the town would have been affected. It has also been suggested that the dancing in the Pied Piper story is an example of the widespread medieval theme of the Danse Macabre, or Dance of Death, with the piper as Death, in the lead. Death was often portrayed in multicolored or pied garb in the Middle Ages.
Another theory holds that the children left as part of a military campaign or a Children's Crusade, in which case the Pied Piper represents their leader or recruiter. This was the most widely accepted explanation until the 1950s. Today, most historians believe that it is most likely that the children of Hamelin left in great numbers to found their own colonies in Eastern Europe, again with a leader personified by the Pied Piper. However, there is still some disagreement about where precisely they settled.
The Grimm brothers' story, as well as Robert Browning's 1842 poem on the subject, relates that the children of Hamelin became the founders of Transylvania. More recent historians have suggested that the children formed colonies in Maehren, Oelmutz, or Ueckermark in Eastern Europe. Place names in areas east of Hamelin, as well as the documentation of many cities being founded around this time, corroborates this theory.
Exactly what happened in Hamelin in 1284 is probably forever lost to history, but whatever it was, it appears to have been traumatic enough for its witnesses to willingly forget the particulars. The various legends inspired by the event are the only concrete record we will likely ever have.