A medieval castle housing ancient treasure; crumbling city towers; crooked-beamed, half-timbered houses that seem to jostle for space on winding cobbled streets: It's hard to compete with Quedlinburg for quaintness. At the foot of the Harz Mountains, this forgotten home of early German kings is a few hours' car journey southwest of Berlin and looks central on a map of the country.

Yet the whole mountain region, steeped in history and mythology, has a lost-in-time, mystical feel. The highest peak of the Harz, the Brocken, is shrouded in mist for an average of 300 days a year. Folklore maintains that the witches and their gods (or in Goethe's version, the devil) hold wild revels there on Walpurgis Night, April 30, to mark the arrival of spring.

The remoteness is partly because the region straddled the Iron Curtain until German reunification 20 years ago, and, like many border areas, was thinly populated on both sides. Quedlinburg, once an important trading post, is now part of the eastern state of Saxony Anhalt, an economically weak region lumbered by a dwindling population and high unemployment. Yet the town's intact houses, spanning 800 years of architecture history, earned it UNESCO World Heritage status in 1994.

Tourism is now the lifeblood of the local economy, and Quedlinburg attracts visitors year-round. In summer, you can hike, cycle and swim in nearby lakes, or simply wander through picturesque lanes with names such as Holy Spirit Street and even Hell, admiring intricate, wood-carved facades. In some places, the upper stories lean so far into the narrow alleys that neighbors facing each other on the street could shake hands without leaving their front rooms.

In winter, cozy cafes beckon, as do the twinkling lights of Christmas market stalls in cobbled courtyards, where caldrons of apple punch and gluehwein bubble over open fires. You can sled and ski in the mountains nearby.

There are also excellent restaurants, not a given in the east German provinces. Theophano im Palais Salfeldt offers seasonal, local products cooked with care and served under the vaulted stone ceilings of a 16th-century palace. For a light, inexpensive supper, try Himmel und Hoelle for crispy Flammkuchen (like a thin pizza with sour-cream topping) and fruit crumbles.

Quedlinburg was spared by Allied bombs in World War II because it had no strategic importance. It largely escaped the anonymous concrete monstrosities favored by planners in Communist East Germany. It did, though, fall into a shocking state of disrepair during decades of Communist neglect.

A major sprucing up has taken place over the past 20 years. Now, most of the old half-timbered houses are restored and inhabited. Only a few still lie gutted and abandoned.

I bought one of the few such houses left, most of it dating from about 1410. A local firm of architects has miraculously transformed it from a rot-ridden ruin with no roof and no back wall into a comfortable, quirky home with 600-year-old beams and wattle-and-daub walls.

Quedlinburg's heyday was in the 10th and the 11th centuries and since then its decline has been long and gradual. King Heinrich I, known as Henry the Fowler in English and generally considered the founder of the medieval German state, made Quedlinburg into a political and cultural center and was buried there in 936. It is not too much of a stretch to call Quedlinburg the first German capital.

The kings of the Ottonian dynasty resided there for short periods, often during major festivals such as Easter. Heinrich's widow, Mathilde, founded a convent, and the town was ruled by its aristocratic abbesses for 800 years, until Napoleon's invasion.

The Romanesque St. Servatius church, standing on a rocky outcrop with an enchanting view over higgledy-piggledy red roofs and towers, gained some notoriety in the past century thanks to the attentions of a more recent Heinrich.

Adolf Hitler's right-hand man and the organizer of the Holocaust, Heinrich Himmler, secretly viewed himself as the reincarnation of the king who suppressed the Slavs in the East. He seized the church and turned it into a shrine for the SS, digging up some bones (almost certainly not Heinrich's) to rebury them in a torchlit midnight ceremony.

Quedlinburg's medieval treasure, on view in the church, has an equally bizarre recent history. After World War II, it was kept for safekeeping in a mine shaft guarded by occupying U.S. soldiers. One of them sneaked out items including a jewel-encrusted, ninth-century manuscript of the gospels, which he shipped home to Texas by mail. They were rediscovered and eventually returned after his death, four decades later, in a tale that belongs in an Indiana Jones movie.

The church and fascinating little museum, complete with medieval torture instruments and the remnants of Himmler's eagle emblem, merit at least a couple of hours. A visit should be rounded off with cheesecake at Cafe Vincent (it boasts 92 varieties) on the cobbled square below.