Hamelin was a town in Lower Saxony, Germany, located near the Weserbergland Mountains.
In 1284, the Pied Piper came down from the mountains to feed on the inhabitants' fear by taking the children away from their parents. (TV: The Day of the Clown)
The children were kept in the Pied Piper's realm until the First Doctor, John and Gillian arrived and decided to help free them. After passing the Pied Piper's three tests, the Doctor took the children back to Hamelin. (COMIC: Challenge of the Piper)