The Pied Piper of Hamelin (), also known as the Pan Piper or the Rat-Catcher of Hamelin, is the title character of a legend from the town of Hamelin (Hameln), Lower Saxony, Germany.

The legend dates back to the Middle Ages. The earliest references describe a piper, dressed in multicoloured ("pied") clothing, who was a rat catcher hired by the town to lure rats away with his magic pipe. When the citizens refused to pay for this service as promised, he retaliated 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. The phrase "pied piper" has become a metaphor for a person who attracts a following through charisma or false promises.

Various theories have arisen about the origin and symbolism of the Pied Piper. Some suggest he was a symbol of hope to the people of Hamelin, which had been subjected to plague; he drew the rats from Hamelin, saving the people from the epidemic.

Plot As the town Hamelin is suffering from a rat infestation, a piper dressed in multicoloured ("pied") clothing appears, claiming to be a rat-catcher. He promises the burgermeister a solution to their problem with the rats. The burgermeister, in turn, promises to pay him 1,000 guilders for the removal of the rats. The piper accepts and plays his pipe to lure the rats into the Weser River, where all the rats drown.

Despite the piper's success, the burgermeister reneges on his promise and refuses to pay him the full sum (reputedly reduced to 50 guilders), even going so far as to blame the piper for bringing the rats himself in an extortion attempt. Enraged, the piper storms out of the town, vowing to return later to take revenge. On Saint John and Paul's day, while the adults are in church, the piper returns, dressed in green like a hunter and playing his pipe. In doing so, he attracts the town's children. 130 children follow him out of town and into a mountain cave, after which they are never seen again. Depending on the version, at most three children remained behind; one is lame and could not follow quickly enough, the second is deaf, so could not hear the music, and the last is blind, so unable to see where he was going. These three inform the townsfolk of what had happened when they came out from church.

Other versions depict the Pied Piper leading the children to the top of Koppelberg Hill, where he takes them to a beautiful land, or a place called Koppenberg Mountain, or Transylvania. In yet other versions, he makes them walk into the Weser River as he did with the rats, and they all drown. Or the Piper returns the children after extorting payment, or the children are returned only after the villagers pay several times the original payment in gold.

The Hamelin street named ("street without drums") is supposedly the last place that the children were seen. Ever since, music or dancing has not been allowed on this street.

Background

The earliest mention of the story seems to have been on a stained-glass window placed in the Church of Hamelin . The window was described in several accounts between the 14th and 17th centuries. It was destroyed in 1660. Based on the surviving descriptions, a modern reconstruction of the window has been created by historian Hans Dobbertin. It features the colourful figure of the Pied Piper and several figures of children dressed in white.

The window is generally considered to have been created in memory of a tragic historical event for the town. According to multiple secondary discussions of Hamelin’s town records, an entry dated 1384 stated: "It is 100 years since our children left."

Although research has been conducted for centuries, no explanation for the historical event is universally accepted as true. In any case, the rats were first added to the story in a version from and are absent from earlier accounts.

14th-century Decan Lude chorus book Decan Lude of Hamelin was reported to have in his possession a chorus book containing a Latin verse giving an eyewitness account of the event.

15th-century Lüneburg manuscript The Lüneburg manuscript () gives an early German account of the event.Illustrated in Rattenfänger von Hameln An article by James P. O'Donnell in The Saturday Evening Post (24 December 1955) tells how an elderly German researcher, Heinrich Spanuth, discovered the earliest version of the story in the Lüneburg city archives in 1936.

On the back of the last tattered page of a dusty chronicle called The Golden Chain, written in Latin in 1370 by the monk Heinrich of Herford, a written version in a different handwriting has the following account:Here follows a marvellous wonder, which transpired in the town of Hamelin in the diocese of Minden, in this Year of Our Lord, 1284, on the Feast of Saints John and Paul. A certain young man thirty years of age, handsome and well-dressed, so that all who saw him admired him because of his appearance, crossed the bridges and entered the town by the West Gate. He then began to play all through the town a silver pipe of the most magnificent sort. All the children who heard his pipe, in the number of 130, followed him to the East Gate and out of the town to the so-called execution place or Calvary. There they proceeded to vanish, so that no trace of them could be found. The mothers of the children ran from town to town, but they found nothing. It is written: A voice was heard from on high, and a mother was bewailing her son. And as one counts the years according to the Year of Our Lord or according to the first, second or third year of an anniversary, so do the people in Hamelin reckon the years after the departure and disappearance of their children. This report I found in an old book. And the mother of the Dean Johann von Lüde saw the children depart.

Rattenfängerhaus It is rendered in the following form in an inscription on a house known as (English: "Rat Catcher's House" or Pied Piper's House) in Hamelin:

According to author Fanny Rostek-Lühmann, this is the oldest surviving account. (High German , meaning a knoll or domed hill) seems to be a reference to one of several hills surrounding Hamelin. Which of them was intended by the manuscript's author remains uncertain.

The Wedding House A similar inscription can be found on the "Wedding-house" or Hochzeitshaus, a fine structure erected between 1610 and 1617 for marriage festivities, but diverted from its purpose since 1721. Behind rises the spire of the parish church of St. Nicholas, which in the words of an English book of folklore, may still "enwall stones that witness how the parents prayed, while the Piper wrought sorrow for them without":

The Town Gate A portion of the town gate dating from 1556 is currently exhibited at the Hamelin Museum. According to Hamelin Museum, this stone is the oldest surviving sculptural evidence for the legend. It bears the following inscription:

Verses in the monastery at Hamelin The Hamelin Museum writes:In the mid 14th century, a monk from Minden, Heinrich von Herford, puts together a collection of holy legends called the "Catena Aurea".  It speaks of a "miracle" that took place in 1284 in Hamelin.  A youth appeared and played on a strange silver flute.  Every child who heard the flute followed the stranger.  They left Hamelin by the Eastern gate and disappeared at Kalvarien Hill.  This is the oldest known account of this occurrence. Around this time, a verse of rhyme is found in "zu Hameln im Kloster".  It tells about the children's disappearance.  It is written in red ink on the title page of a missal.  It bewails "the 130 beloved Hamelner children" who were "eaten alive by Calvaria".  The original verses are probably the oldest written source of this legend.  It has been missing for hundreds of years.However, different versions of transcriptions of handwritten copies still exist. One was published by Heinrich Meibom in 1688. Another was included by Johann Daniel Gottlieb Herr under the title Passionale Sanctorum in Collectanea zur Geschichte der Stadt Hameln. His manuscript is dated 1761. Some Latin verses had a prose version underneath:

16th- and 17th-century sources Somewhere between 1559 and 1565, Count Froben Christoph von Zimmern included a version in his .F. C. von Zimmern [attr.]: Zimmerische Chronik, ed. K. A. Barack (Stuttgart, 1869), vol. III, pp. 198–200. This appears to be the earliest account which mentions the plague of rats. Von Zimmern dates the event only as "several hundred years ago" ( ), so that his version throws no light on the . Another contemporary account is that of Johann Weyer in his (1563).

Theories

Natural causes

A number of theories suggest that children died of some natural causes such as disease or starvation, and that the Piper was a symbolic figure of Death. Analogous themes which are associated with this theory include the Dance of Death, or , a common medieval trope. Some of the scenarios that have been suggested as fitting this theory include that the children drowned in the river Weser, were killed in a landslide or contracted some disease during an epidemic. Another modern interpretation reads the story as alluding to an event where Hamelin children were lured away by a pagan or heretic sect to forests near Coppenbrügge (the mysterious "hills" of the poem) for ritual dancing where they all perished during a sudden landslide or collapsing sinkhole.

Emigration Speculation on the emigration theory is based on the idea that by the 13th century, overpopulation of the area resulted in the oldest son owning all the land and power (majorat), leaving the rest as serfs.. It has also been suggested that one reason the emigration of the children was never documented was that the children were sold to a recruiter from the Baltic region of Eastern Europe, a practice that was not uncommon at the time. In his book The Pied Piper: A Handbook, Wolfgang Mieder states that historical documents exist showing that people from the area including Hamelin did help settle parts of Transylvania. Emily Gerard reports in The Land Beyond the Forest an element of the folktale that "popular tradition has averred the Germans who about that time made their appearance in Transylvania to be no other than the lost children of Hamelin, who, having performed their long journey by subterranean passages, reissued to the light of day through the opening of a cavern known as the Almescher Höhle, in the north-east of Transylvania." Transylvania had suffered under lengthy Mongol invasions of Central Europe, led by two grandsons of Genghis Khan and which date from around the time of the earliest appearance of the legend of the piper, the early 13th century.

In the version of the legend posted on the official website for the town of Hamelin, another aspect of the emigration theory is presented:

Among the various interpretations, reference to the colonization of East Europe starting from Low Germany is the most plausible one: The "Children of Hameln" would have been in those days citizens willing to emigrate being recruited by landowners to settle in Moravia, East Prussia, Pomerania or in the Teutonic Land. It is assumed that in past times all people of a town were referred to as "children of the town" or "town children" as is frequently done today. The "Legend of the children's Exodus" was later connected to the "Legend of expelling the rats". This most certainly refers to the rat plagues being a great threat in the medieval milling town and the more or less successful professional rat catchers.

The theory is provided credence by the fact that family names common to Hamelin at the time "show up with surprising frequency in the areas of Uckermark and Prignitz, near Berlin."