Most of the world’s castles, dating back as far as the dark ages, have crumbled into ruin. But there are still many of these daunting stone fortresses and palaces that live on in a new way – as homes, hotels, museums, universities and even bookstores. These 13 converted castles from the 10th to 19th centuries remain functional works of architecture, whether augmented by modern construction or historically preserved.

Messner Mountain Museum, South Tyrol, Italy

Leaving the historic exterior largely untouched, Italian architects EM2 converted a castle in the Alps into a mountaintop museum. Messner Mountain Museum houses a permanent exhibition about people who live in mountain communities around the world. EM2 added wooden stairways to many of the rooms, opened up the basement and constructed a few new spaces out of unfinished timber.

Grey Towers Castle at Arcadia University, Pennsylvania

Grey Towers Castle was built starting in 1893 as the estate of William Welsh Harrison, and was acquired by Arcadia University in Glenside, Pennsylvania in 1929. The castle is rumored to have secret passages behind the fireplaces as well as a series of underground tunnels built to connect the main house to stables and outbuildings. It now contains various offices, including that of the President, as well as student residences.

Hay Castle Books, Wales

Hay-on-Wye, Wales is often described as “the town of books” thanks to its large collection of bookstores and libraries, and none are more magnificent than Honesty Bookshop, a 24-hour open-air bookshop on the grounds of Hay Castle. The books, which are kept in bookcases against the castle wall, are paid for through a small letterbox. Elsewhere on the castle grounds, a mansion built in the 1660s is used for second-hand book sales.

Ashford Castle, Ireland

On the shore of Lough Corrib in County Galway, Ireland, a medieval castle built in 1228 now offers the royal experience to any paying guests. Ashford Castle was converted into a five-star luxury hotel in the 1940s, and its 26,000-acre grounds include a 17th-century French-style chateau.

Moritzburg Museum, Halle, Germany

A ruined castle in Halle, Germany has been given a new life thanks to modern extensions by Spanish studio Nieto Sobejano Arquitectos. The formerly roof-less castle is now protected by a second-floor extension of modern steel, glass and stark white plaster, contrasting beautifully with the 15th century stonework. The structure now houses a notable collection of modern art, mostly German Expressionism.

Castell d’Emporda, Spain

Among the many breathtaking castles that have been converted to hotels in Spain is the Castell d’Emporda, which was augmented in 2011 with rusted steel parasols that shelter a terraced outdoor restaurant. The 14th century Castell d’Emporda, located on the Costa Brava, was fully preserved when it was turned into a boutique hotel in 1999.

Wilton Castle Luxury Apartments, England

Want to live in an actual castle? Unless you’ve got a royally loaded bank account, Wilton Castle in Yorkshire may be among your only chances. Though it was built in the early 19th century – on the grounds of a medieval castle – it has retained a feel befitting its history. The castle has been converted into luxury residential apartments.

Carbisdale Castle Hostel, Scotland

Few hostels can boast surroundings quite as atmospheric as those at Carbisdale Castle in the Scottish Highlands. Built in the early 1900s for Mary Caroline, Duchess of Sutherland, Carbisdale Castle is now a youth hostel boasting a large collection of art, 365 windows, a clock tower and even a secret door opened by rotating a nearby statue.

Parador-Castillo de Tortosa, Spain

The Moorish king Abderraman III built the majestic Parador de Tortosa as a fortress in the 10th century. Today, the castle is a hotel, nestled in the fertile Ebro valley of the Catalan region of Spain.

The Witchery, Scotland

While there are any number of old castles converted to hotels in Great Britain, none have interiors quite as magical as those at the appropriately named ‘Witchery’ in Edinburgh. Popular with celebrities and wildly in demand, The Witchery by the Castle is as well known for its richly decorated, theatrically baroque suites as for its critically acclaimed restaurant. The hotel’s 8 guest suites feature ornate drapery, renaissance-style paintings, Victorian baths, fireplaces and even hidden rooms.

Scottish National War Memorial, Scotland

Located on the historic grounds of Edinburgh Castle in Scotland, the Scottish War Memorial occupies a converted barrack block on the north side of Crown Square. Though technically, this building is not a former castle, the bricks used to build it in the 1920s and ’30s are from the medieval St. Mary’s Church, which was built in 1366.

CN Castle, Portugal

How do you honor and preserve the remains of a historic castle, without attempting to rebuild it? Comoco Architects built modern viewing and exhibition spaces around the crumbling remains of Portugal’s Castelo Novo, allowing visitors to view the archaeological findings of the site without damaging them. A ‘steel box’ inside the castle’s main tower functions as multimedia room as well as an overlook.

University College, England

Built in the 11th century, Durham Castle was a bishop’s palace for centuries before it was donated to the newly-formed University of Durham in 1837. Today, the castle houses over 100 students, and meals are eaten in the castle’s great hall. The castle, along with the adjacent Durham Cathedral, is a UNESCO World Heritage Site.