To think of Germany without its many legends, sagas, fables and fairy tales is almost not to think of it at all. That axiom takes on special meaning this year and next -- the bicentennial celebration of the births of the Grimm brothers, Jacob and Wilhelm, born 14 months apart in 1785 and 1786.

Now, the Grimms are renowned for many things. In esoteric circles they are revered for their scholarly research on language and grammar. Their most monumental achievement, actually not completed until a century after their death, was the "Deutsches Wo rterbuch," a 32-volume, 35,000-page encyclopedic dictionary of German. But what has endeared those two assiduous philologists to generations of fans are their collections of myths, folk tales and parables.

Without Jacob and Wilhelm Grimm, who would know about Hansel and Gretel, Snow White, Cinderella, Puss in Boots, Rapunzel or Rumpelstiltskin? But of all the tales they collected, one of the oddest is that of the Pied Piper of Hamelin. And it is a tale that remains shrouded in mystery.

In fact, solving this whodunit might curl even the hair of a Rapunzel. But the mystery has certainly helped put Hamelin on the map. It deserves to be. This city of 60,000 is one of the most dazzling and picturesque in West Germany today -- a perfectly preserved Old World gem, as charmingly quaint and colorful as a travel poster. During this Grimm brothers bicentennial, it merits a special trip.

In 1284 -- so goes the Grimms' version of the yarn -- a strange man entered Hamelin. He wore a coat of many-colored cloth and claimed to be a rat-catcher. He offered to free the city of its plague of rodents for a large sum of money. After the burghers had promised him this fee, he took out a little silver flute and began to play. On hearing the tune, all the rats and mice came running out of their holes and surrounded the piper, who then led them out of Hamelin to the Weser River, into which they plunged and perished.

As soon as Hamelin was freed of the scourge, the Grimm brothers tell us, the burghers reneged on their promise and refused to pay the piper. Full of bitterness he left town, only to return a few days later -- June 26 -- again sounding his flute in the streets.

This time it did not bring forth rodents, but every child in Hamelin over the age of 4. In great numbers they were led by the piper out through the East Gate and into a hill, where they disappeared. Only two children came back, but one of these was blind and had seen nothing, and the other was a mute and unable to tell what had happened. Some people say the children were led into a cavern and came out at the other end in Transylvania. All together, 130 children were lost.

To be sure, the Grimm brothers were not the only writers of the romantic period to recount this parable about human greed. Goethe was one. Another was Robert Browning who, it is said, was the first to insert the "i" into the city's German name -- Hameln -- to improve the meter of his verse. More important, however, the legend has been around for at least 600 years, and that raises a knotty question. Is there something to it?

There's a good argument to be made for the claim that on June 26, 1284, some 130 young people, though not necessarily children, really did leave Hamelin, never to return, lured by a handsome and exceptionally well-dressed young man playing a silver flute. And in recent years researchers have been turning medieval archives topsy-turvy to prove it. They have made some startling discoveries.

The most amazing find is an illuminated manuscript, dating from around 1450, which in turn is a shortened version from an even earlier book of around 1370 by a Benedictine monk named Heinrich von Herford. That has been lost. Annotations in the 15th-century manuscript refer to the earlier one and mention an eyewitness to the disappearance -- "the mother of Dean Johann von Lu den." Von Lu den was no mythical figure but the member of a rich and prominent Hamelin family in the Middle Ages. Born in 1299, he was dean of Hamelin's St. Boniface collegiate basilica for some 40 years, until his death in 1378. His mother would have been a child at the time of the mysterious 1284 exodus.

There also appears to have been an even earlier reference: a panel in a stained-glass window of Hamelin's Marktkirche (Market Church). It depicted a group of people surrounding a colorfully dressed man. That window, made in 1314, was removed from the church during a renovation in 1660 and has also disappeared.

But what's behind the tale, if it is true? Over the centuries there have been dozens of theories. The most widely accepted today is that the "children" were young people and the "piper" a recruiter who induced them to colonize territories conquered by German knights in what is now Eastern Europe. These could have been lands in Pomerania, now part of Poland, or in the Moravian region of Czechoslovakia. Indeed, up to about 100 years ago there was a settlement with the linguistically incongruous name of Hemlincow in Moravia.

In exchange for land and freedom from serfdom the colonizers may have had to pledge never to return to Hamelin. There is also the theory that they were indentured servants of Hamelin's powerful St. Boniface monastery who welched on their contracts by fleeing eastward with the recruiter. That might explain that long-lost stained glass window which, according to one historian, could have been installed in 1314 as an act of atonement by relatives left behind.

But what about the rats?

"They didn't enter the story until 300 years later, in the 16th century," says Norbert Humburg, director of the Hamelin city museum, who has even studied rat psychology to get to the bottom of that aspect of the story.

Because of its medieval role as a grain-trading center, with mills, silos and warehouses strung along the Weser River, Hamelin must have been a magnet for rodents as well as for "rat catchers" offering their various services and miracle techniques.

One method to trap rats and mice is indeed the use of "music" or, to put it more precisely, shrill tones. Among the objects in Humburg's museum, first displayed in 1984 for the 700th anniversary of the Pied Piper legend but now part of a permanent exhibit, is a small metal fife, donated a number of years ago by a professional exterminator in Corby, England. When played by an expert, the ear-piercing sound it emits imitates the screech and shriek of rats at mating time and lures them into a trap. The trick is to get the right pitch.

"But the rats are really a side issue," says Humburg. "The important question is who was the piper and what happened to the children."

Hamelin's origins as a fishing village reach far back into the Dark Ages. It was not until around 800 A.D. that the town first made a mark on recorded history, with the establishment of a Benedictine abbey where the basilica of St. Boniface stands today.

The town rose to power and wealth as a shipping, trading and grain-milling center in the Middle Ages. For nearly 150 years, from 1426 to 1572, it was an independent city-state and member of the Hanseatic League. Its splendid form -- a kaleidoscope of Gothic and Renaissance chapels, churches, public buildings, burgher houses and patrician mansions -- took shape in those times. No other town has as many fine examples of "Weser Renaissance" architecture, a specific style along that river that is characterized by the use of two-story oriels, called utluchts (outlooks), to the left of the large, portal-like main doors; richly embellished gables; and prominent horizontal lines between each floor.

Like many smaller German cities, Hamelin escaped the ravages of World War II. A March 14, 1945, air raid destroyed only the railway station and the neighborhood immediately around it, and an artillery barrage in April, a day before U.S. Army troops moved in, wrecked some of the historic structures around the Markt (market square).

But unlike many other cities and towns, it was also spared the devastation of "modernization" and "urban renewal" during the postwar "economic miracle" years -- a mindless process that has destroyed almost as much of West Germany's artistic, cultural and architectural heritage as all the bombs dropped by Allied planes.

To be sure, the same fate almost befell the Pied Piper town. In 1968, the city council adopted a plan to raze more than one-fourth of the historic old quarter and replace it with department stores and box-shaped apartment houses. Fortunately, the plan was unveiled just about the time West Germans were starting to realize what they had wrought during the postwar years.

Hamelin's burghers rebelled, and following a five-year battle in the courts and the political arena, the plan was largely scrapped. Preservation, restoration and renovation became the new catchwords, and millions of dollars were poured into conserving and refurbishing some of Hamelin's finest examples of 16th- and 17th-century architecture.

The work will not be completed until late 1987 or early 1988, but it has already turned Hamelin into an urban jewel and a tourist highlight. Entire sections of the city look as if they had survived the eras unscathed, which, on the whole, they have. All that has changed is that the interiors of those lovely old houses have been updated to give inhabitants long missing modern conveniences such as central heating, indoor plumbing and energy-saving insulation. Walking about town, romanticists such as Goethe, Browning and the Grimm brothers would feel happily at home.

Even the rats are gone. They had indeed plagued Hamelin for centuries because of its riverside location and role as a grain trade center with numerous warehouses and flour mills. While the Pied Piper may be no more than a legend, the rats were vexingly real and so were the rat catchers: quacks and charlatans who promised to free the town of this scourge and fleeced the burghers for generations on end.

They are no longer needed. The last mill shut down its operations in the old quarter 14 years ago, and the rodents left Hamelin for more rewarding turf. To be sure, there are still plenty of rats around: cuddly ones of plush with brown button eyes in every gift and souvenir store on Ba cker Strasse, and rats of marzipan and cookie dough in nearly every bakery and pastry shop. But a real one has not been seen since 1972.

Today, the legend of the Pied Piper is reenacted by 130 local youngsters and several dozen burghers, including 54-year-old Siegfried Sacher, a municipal clerk, at noon every summer Sunday. The amateur actors are colorfully costumed, the kids first as rodents, then in medieval garb as the missing children. The only departure from the tale as told by the Grimm brothers is that Sacher, who has been acting the Pied Piper role every summer for 20 years, plays an oboe instead of a flute. The half-hour pageant is staged on the market square in front of the Hochzeitshaus (Wedding House), a town and festival hall built between 1610 and 1617.

The best way to explore an old city is on foot. In Hamelin it is the only way, since almost the entire Altstadt (Old Town) has been turned into a pedestrian mall with no automobile traffic allowed. But even the weak-kneed and footsore will find it manageable. The historic old quarter from north to south is merely a half-mile long and from west to east only one-third of a mile wide. Everything worth seeing is tucked into this compact little package of narrow, winding cobblestone lanes, idyllic squares and dreamy plazas.

The area was once surrounded by Hamelin's medieval walls, towers and turrets. Those, alas, have been gone a long time. All that remains are two towers, the Pulverturm and the Haspelmathturm.

Though the towers are certainly picturesque, a better place from which to start a walking tour of Hamelin is from the East Gate, through which the Pied Piper supposedly led the children. That is where Oster Strasse begins. This broad street is lined by magnificent patrician mansions in Weser Renaissance style. The one closest to the gate, and the most famous, is the Rattenfa nger Haus, the Rat Catcher House, so named not because he ever lived in it but because of the inscription on the building that tells the legend.

The house was built in 1602 for a wealthy and powerful town councillor, Hermann Arends, and the story about the Pied Piper -- told in archaic Middle High German and without the part about the rats -- was chiseled there 383 years ago. Today the house is one of Hamelin's most colorful and popular restaurants, whose best-known specialty is a dish called "Rat Tails." These are actually very tender pork filets.

The short and narrow little lane at the side of the house is called Bungelosen Strasse, meaning "the street without bungen." A bunge in the German dialect of medieval Hamelin is a drum, and the implication for nearly six centuries has been that no drums may be thumped -- that is, no music played -- in this street. It was through this lane, to the East Gate, that the Pied Piper led the children, either piping his flute or tooting his horn. The no-music rule, in solemn commemoration of the 130 youngsters, was actually enforced until the late 19th century.

The Leist Haus at Oster Strasse No. 9, on the opposite side and a bit further down the street, was built between 1585 and 1589 for Gerd Leist, a Hamelin merchant. It stands a few doors from an equally impressive Renaissance style mansion, Oster Strasse No. 12, built in 1576.

A peek at the embellished gables of both will tell you something about the realities of life in 16th-century Hamelin. In each gable there is a bust with a rather grim face. The two are called the neidkopfe -- heads of envy. Their stated purpose was to keep evil spirits from the house, but in this case the intent was a bit more devious: pure jealousy, as Eiko Hartmann, the director of Hamelin's tourist office, tells the story.

After the 1576 house was built, it seems, it had been the grandest and most admired on Oster Strasse. Then Leist came along a decade later and built his far more ostentatious home. His neighbor was envious and began spreading gossip about Leist, saying he had made his money crookedly and had built the house with ill-gotten profits.

To protect himself against such evil rumors, Leist told his architect to install the sculpted head in the gable. Its features, however, resembled those of his rumor-spreading neighbor. No sooner was the effigy in place than the neighbor also called in a stone mason to put a little bust in his own gable, this one an unmistakeable likeness of Gerd Leist. The heads have been there for nearly 400 years.

Adjacent to the Leist Haus, and now connected to it by a second-floor passageway, is the Stiftsherren Haus, a dazzling display of half-timbering built between 1556 and 1558 for Friedrich Poppendieck, another of medieval Hamelin's merchant princes. It is one of the most elaborately decorated framework buildings in Germany, noted for its wood carvings of biblical and mythological figures on the facade. It and the Leist Haus now harbor the collections of the Hamelin Museum.

The story of the Pied Piper is not the only one for which Hamelin is known. On Jan. 9, 1600, it is said that Anna, the wife of well-to-do burgher Tile Ro mer, gave birth to septuplets, the first such multiple birth in the world. The infants died shortly after. A 17th-century bas relief, commemorating the event and depicting the Ro mers, their five other children and the seven babies, is on the wall of the Hochzeitshaus at the corner of Oster Strasse and Emmern Strasse.

The name Hochzeitshaus, when literally translated as Wedding House, is a bit misleading. A hochzeit today is indeed only a wedding, but in medieval German it also meant a hohe zeit, a high time or festival, and it was as a festival and banquet hall that the house was built in the early 17th century. For a while it also served as Hamelin's city hall.

The city registrar's office is still in the building and it is the scene of some half-dozen civil marriage ceremonies every morning. One of Hamelin's popular forms of entertainment is to stand out on Oster Strasse and watch the couples come out. There's always a crowd around the entrance, and invariably a log adorned with ribbons and set on a sawhorse. Local custom demands that the newlyweds saw the log apart -- to the accompaniment of much laughter and encouraging advice from bystanders.

One of Hamelin's greatest attractions, though only installed in 1934, is the carillon on the market square facade of the Hochzeitshaus. The brightly painted bronze figures depict the Pied Piper legend, rats and all. The 29 bells chime, the two huge iron doors open and the figures emerge at 1:05, 3:35 and 5:35 p.m. daily. (The odd times were chosen so that the carillon would not be drowned out by the tolling of the Market Church bells every hour and half-hour.)

The most dazzling piece of Renaissance architecture around the market square is the Dempter Haus, built in 1607 for Tobias von Dempter, then Hamelin's burgomaster. What is so unusual about the lavishly decorated building is that its two lower floors are stone, the upper three half-timbered.

The character of the Old Town changes dramatically along Fischerpforten, Stuben, Wenden, Alte Markt and Neue Markt streets. Narrow, cobblestoned and lined by dizzily tilting framework houses, they are perfect for soaking up atmosphere. A leisurely stroll along them will also give you an idea of how those $135 million in restoration funds were spent.

Ba cker Strasse is the main shopping street, with the usual array of department stores, but two of its houses are important.

One is the Lo wen Apotheke at the corner of Ba cker and Neue Markt streets. Built in 1300, it was the domicile of Hamelin's "protected" Jews in the 14th century. A Star of David in the gable is the only decoration. How that symbol survived the Nazi holocaust is a story Hameliners are eager to tell.

The star is not straight up but sits a bit askew, its points at an angle. When the local Nazi gauleiter demanded that it be removed or covered up, the owner of the Lo wen pharmacy protested, saying that it could not possibly be a Jewish symbol with the tips of the star pointing that way. The Nazi official bought that line and the star remained in place throughout the Third Reich. The house is one of the oldest in town. Only the Rattenkrug at No. 16 Backer Strasse is older, though you'd never guess it, the fac,ade being a fine example of Renaissance decor. A fac,ade, however, is all it is, put up in 1569. The building itself dates from 1250.

What would Hamelin be without the Pied Piper? It certainly wouldn't be as well known, but it would still be a gem among Germany's surviving medieval towns, a vibrant little fairy tale city where the past is surprisingly alive.