The Pied Piper of Hamelin (German: Rattenfänger von Hameln also known as the Pan Piper, the Rat-Catcher of Hamelin) is the subject character of a legend from the town of Hamelin (Hameln), Lower Saxony, Germany. The legend dates back to the Middle Ages, the earliest references describing a piper, dressed in multicolored ("") clothing, who was a rat-catcher hired by the town to lure rats away with his magic pipe. When the citizens refuse to pay for this service, he retaliates by using his instrument's magical power on their children, leading them away as he had the rats. This version of the story spread as folklore and has appeared in the writings of Johann Wolfgang von Goethe, the Brothers Grimm, and Robert Browning, among others.
There are many contradictory theories about the Pied Piper. Some have been proposed suggesting he was a symbol of hope to the people of Hamelin, which had been attacked by plague; he moved all the rats out from the town of Hamelin, thus saving the people from the epidemic disease.
The earliest known record of this story is from the town of Hamelin itself, depicted in a stained glass window created for the church of Hamelin, which dates to around 1300. Although it was destroyed in 1660, several written accounts have survived.
In 1284, while the town of Hamelin was suffering from a rat infestation, a piper dressed in multicolored clothing appeared, claiming to be a rat-catcher. He promised the mayor a solution to their problem with the rats. The mayor, in turn, promised to pay him for the removal of the rats. (According to some versions of the story, the promised sum was 1000 guilders.) The piper accepted and played his pipe to lure the rats into the Weser River, where all but one drowned.
Despite the piper's success, the mayor reneged on his promise and refused to pay him the full sum (reputedly reduced to a sum of 50 guilders) even going so far as to hint that he brought the rats himself in an extortion attempt. The piper left the town angrily, vowing to return later to take revenge. On Saint John and Paul's day, while the Hamelinites were in church, the piper returned dressed in green like a hunter playing his pipe. In so doing, he attracted the town's children. One hundred and thirty children followed him out of town and into a cave and were never seen again. Depending on the version, at most three children remained behind: One was lame and could not follow quickly enough, the second was deaf and therefore could not hear the music, and the last was blind and unable to see where he was going. These three informed the villagers of what had happened when they came out from church.