(CNN) -- What is it about castles that fascinates so many people around the globe?
A lot of the allure derives from the history and human drama that played out within the walls, as well as the astonishing architecture that features on so many castles. But they're also romantic and somewhat mystical, places that spark our imagination and conjure visions of long-ago knights in shining armor and powerful warrior queens.
"Because they combine two functions, they are far more interesting than fortresses or palaces," says Marc Morris, author of "Castles: Their History and Evolution in Medieval Britain."
"What makes a castle a castle is that it combines the functions of defense and dwelling -- it's a fortification and a stately home rolled into one. Creating a building which is both comfortable and defensible is difficult. The ingenious ways in which castle-designers reconciled this balance is always intriguing."
Although we normally associate castles with European history, it's actually an architectural form found around the world -- in nations as varied as Japan and India, Morocco and Mexico.
Many are now hubs of living history where modern visitors can watch jousting and other ancient combat forms, listen to medieval music or watch artisans demonstrate the arts, crafts and everyday skills of a thousand years ago.
They also make great backdrops for outdoor concerts, films, theater and military performances, or for the on-location filming of movies and television shows.
"With a castle you get not only the stories of sieges, but also stories of the domestic lives of the rich and famous," says Morris. "Castles are places were plots were hatched, marriages were consummated, murders carried out, royal babies born, and so on. With castles, you are never short of fascinating things to talk about."
Read on to find out more about 21 of the world's most beautiful castles, fortified homes that are both a feast for the eyes and a time trip back to the bygone age during which they were created.
Himeji Castle, Japan
Located about 30 minutes by bullet train west of Osaka and Kobe, Himeji rises above the Inland Sea and is considered the epitome of the Japanese feudal castle.
Both a Japanese national treasure and World Heritage Site, the elegant whitewashed structure is also called "White Heron Castle" because of its resemblance to a great bird taking flight.
Completed in the early 17th century, Himeji offers daily guided tours in Japanese and English.
Palace of the Grand Master of the Knights of Rhodes, Greece
This classic medieval castle towers above the island of Rhodes in the Aegean Sea. Originally built as a Byzantine citadel, it was reworked into its present Gothic form by the crusading Knights of St John when Rhodes served as the headquarters of their grand master.
During the brief Italian occupation of the Dodecanese Islands, Benito Mussolini used the castle as a holiday home. Its permanent archeological exhibitions feature relics from ancient Greece and the early Christian period.
Neuschwanstein, Germany
Even though many people consider this Bavarian masterpiece the epitome of a German castle, it's a relatively new creation, erected in the late 1800s at the behest of King Ludwig II.
The Bavarian monarch instructed his architects to design something that would reflect both the operas of Richard Wagner and the romantic ideals of the Middle Ages -- as much a fantasy as Sleeping Beauty Castle at Disneyland, but with the snowcapped Alps as a backdrop and the Bavarian plains spread out beneath.
Neuschwanstein is also a cinema darling, having appeared in numerous flicks over the years including "Chitty Chitty Bang Bang" and "The Great Escape."
Alcázar of Segovia, Spain
One of the most striking castles in all of Europe, the Alcázar rides a narrow, rocky promontory overlooking the plains of Old Castile in central Spain.
Although it started life as a Roman fort, the structure evolved over hundreds of years into a prototypical medieval castle with a deep moat, drawbridge, round guard towers and a robust keep, as well as lavishly decorated royal chambers.
Segovia Castle is most renowned as the home of Queen Isabella and powerful Phillip II before the royal court was moved to Madrid.
Pena Palace, Portugal
Another offspring of the Romantic movement that swept 19th-century Europe, Pena crowns a hilltop near Sintra, Portugal.
Commissioned by King Ferdinand II on the site of a ruined monastery dedicated to the Virgin of Pena, the castle is a flamboyant blend of various historic styles including Gothic, Moorish and Renaissance details.
The castle's vivid red-and-yellow color pattern -- and its flashy clock tower -- endow Pena with a much more playful air than the somber castles found elsewhere in Europe.
Amber Fortress, India
Erected in the early 17th century by the Mughal ruler of Rajasthan, theAmber Fortress crowns a hilltop near Jaipur, its stout walls reflected in the waters of Maota Lake.
The palace complex inside the walls revolves around courtyards flanked by exquisite examples of Rajput architecture like the Maharaja's Apartments, Sukh Niwas (Hall of Pleasure) and Diwan-i-Am (Royal Audience Hall).
Although it was once fashionable to ride an elephant up the steep entrance road, visitors are now advised to walk or take a 4x4 taxi.
Ksar of Aït-Ben-Haddou, Morocco
This massive mudbrick structure on the edge of the Sahara has starred in more than a dozen movies and television shows including "Game of Thrones," "Gladiator" and "The Man Who Would Be King."
The complex features a fortified lower town along the Asif Ounila River -- where people still reside -- and a partially ruined hilltop citadel.
Berber-style guest houses provide accommodation for visitors to a ksar originally built in the 17th century as an overnight stop for caravans traveling between Marrakech and the Sudan.
Kalmar Castle, Sweden
Founded in the waning years of the Viking Age, Kalmar Castle traces its roots to a 12th-century defensive tower overlooking the Kalmar Strait on the Baltic Sea.
Four centuries later, King Gustav and his sons transformed Kalmar into a splendid royal residence that (with the help of renovation) looks much the same today as it did in 1592.
In addition to exhibitions, children's activities and guided tours, Scandinavia's best-preserved Renaissance castle also features special events like the Van Gogh multimedia show, which is open until November 2019.
Castillo San Felipe del Morro, Puerto Rico
Guarding the entrance to San Juan Bay, this 16th-century Spanish citadel is one of the most impressive structures in the Caribbean.
Protected by a moat (with a drawbridge), stone battlements and rugged sea cliffs, the castle has repelled numerous attacks including several assaults by French pirates and a 1595 strike by Sir Francis Drake. However, it surrendered to US forces after a fierce naval bombardment during the Spanish-American War.
Since 1962, El Morro and nearby Castillo San Cristóbal (the largest fort constructed by the Spanish in the western hemisphere) have been part of the San Juan National Historic Site. The grassy "field of fire" in front of the castle is now immensely popular for picnics and kite flying.
Topkapi Sarayi, Turkey
Although it's officially called a palace, Istanbul's sprawling Topkapi compound bears all the features of a classic castle: defensible site, fortified walls, powerful gateways and a royal residence occupied by the Ottoman sultans from the late 15th century when it was originally constructed until the 1850s.
Converted into a museum when the Ottoman Empire dissolved after World War I, the Topkapi offers extensive gardens, wall-top walks overlooking the Bosphorus, the Ottoman Imperial Harem where the ruler's concubines resided and the Imperial Treasury with its famous emerald-encrusted golden dagger -- stolen and eventually retrieved in the 1964 heist movie "Topkapi."
Edinburgh Castle, Scotland
Perched on an ancient volcanic outcrop at the end of the Royal Mile, Edinburgh Castle is considered the "most besieged place" in Britain with at least 26 major attacks during its 1,100-year lifespan.
From Mary Queen of Scots to Oliver Cromwell and Sir Walter Raleigh, many famous Britons are indelibly linked the ancient edifice.
Britain's oldest crown jewels (the Honours of Scotland) are safeguarded inside a castle that also provides an incredibly fitting venue for the annual Royal Edinburgh Military Tattoo.
Music concerts, living history events and weapons demonstrations are among the many events staged throughout the year inside the walls. And bygone military mascots are buried in the castle's Dog Cemetery.
Schloss Vianden, Luxembourg
Despite its diminutive size, the Grand Duchy of Luxembourg is well-endowed with castles -- more than 50 are spread across an area smaller than London's metro area. The most spectacular of these is Schloss Vianden, poised high above the Our River in northern Luxembourg.
Built on the site of an ancient Roman fortress that protected the empire from barbarian invasion, the castle was constructed between the 11th and 14th centuries.
Blending aspects of Romanesque, Gothic and Renaissance design, it remained in royal hands until 1977 when the Grand Duke bequeathed it to the state. Vianden's biggest annual bash is an August medieval festival with dueling knights, troubadours, jugglers and artisans.
Novgorod Detinets, Russia
The Kremlin in Moscow may be better known, but it can't hold a candle to the one in Novgorod when it comes to medieval ambiance.
Located 200 kilometers (124 miles) south of St. Petersburg, Novgorod was the seat of a powerful Russian republic from the 11th to 15th century when it was finally overshadowed by Moscow.
That power was concentrated inside the detinets or kremlin with its sturdy walls and heavily fortified towers.
Among its landmarks today are the Cathedral of the Holy Wisdom with its silver domes, the Novgorod Museum and the Millennium of Russia monument.
Château de Chambord, France
There's no better example of the transition from the fortified castles of the medieval era to palatial homes of the Renaissance than this enormous chateauin the Loire Valley.
Commissioned as a "hunting lodge" by King François I in the early 16th century, the massive structure (440 rooms) took 28 years to construct.
However, the moat, corner towers and keep are purely decorative. Chambord is celebrating its 500th anniversary this year with myriad special events including an exhibition that addresses the question of whether Leonardo da Vinci designed the castle's double helix staircase.
Shuri-jô Castle, Okinawa
One of the finest examples of Chinese castle architecture is Shuri, a hilltop fortress and palace complex on the island of Okinawa in Japan.
As the royal court of the independent Ryukyu Kingdom for more than 450 years -- when the islands were heavily influenced by nearby China -- Shuri developed a warren of imperial living quarters, audience halls, religious shrines and an extravagant throne room reminiscent of the Forbidden City in Beijing.
The compound was heavily restored after World War II, when Shuri served as the local headquarters for the Imperial Japanese Army. The castle's present-day activities range from a morning gate-opening ritual called Ukejo and multilingual audio tours of the grounds to daily dance performances and nighttime illumination.
Bodiam Castle, England
England has far larger castles (Windsor) and others that are more steeped in history (Tower of London). But none boasts that textbook form ofBodiam Castle in East Sussex.
Erected in 1385 as the bastion of a former royal knight, it's the epitome of a medieval castle -- thick crenelated walls supported by nine stubby towers, arrayed around a square central courtyard and reached via a wooden walkway (a drawbridge in olden days) across a wide moat.
Among its many visitor summer activities are archery sessions, dressing up in medieval costumes, afternoon tea with cakes and scones and guided tours. And just seven miles away is where the landmark Battle of Hastings played out in 1066.
Castillo de Chapultepec, Mexico
The only royal castle in the Western hemisphere hovers high above Mexico City.
Erected in the late 1700s as a summer house for the viceroy of New Spain, the castle has played many roles since then, including the palace of Emperor Maximillian and an 1847 battle between Mexican troops and invading Americans that features in the "Marine Corps Hymn" ("From the Halls of Montezuma . . .").
Nowadays Chapultepec is home to Mexico's National Museum of History. The royal quarters -- including the precious Malachite Room and Maximillian's flamboyant bedroom -- are included in castle tours.
Predjama Castle, Slovenia
What makes this Slovenian castle so special is its astounding location -- Predjama is arrayed across a cave mouth beneath a natural rock arch on the side of a sheer cliff.
The lofty setting made it virtually impregnable when it was constructed in the 13th century. Attackers laid siege to Predjama on numerous occasions, but a secret passageway (that still exists today) allowed the defenders to come and go at will.
Located 62 kilometers (38 miles) from Ljubljana, the castle and its park-like grounds host the Erasmus Knight's Tournament, a medieval festival and jousting competition staged every July.
Castello Aragonese, Italy
This island bastion overlooking the Bay of Naples is the oldest castle on our list, tracing its roots to the 5th century BC when Greeks colonized the region. From Roman legionnaires to Napoleon's troops, many armies have occupied Aragonese over the years.
The castle now belongs to the family of an Italian lawyer who purchased the fortified island in 1912 and began restoration of its battlements, churches, convents, crypts and gardens. In addition to views that stretch all the way across the bay to Mt. Vesuvius, Aragonese Castle boasts outdoor cafes, a bookshop, art exhibits and outdoor movies.
Prague Castle, Czech Republic
Prague's imposing citadel is also one of the few castles anywhere in the world that still boasts real political power -- the official residence of the president of the Czech Republic.
Among the other landmarks inside its spacious confines are St Vitus Cathedral, the Old Royal Palace, 10 gardens and a row of 16th-century cottages called the Golden Lane that once housed the castle guards.
Guided tours, offered during daylight and evening hours, last around three hours.
Krak des Chevaliers, Syria
Although it's virtually impossible to visit these days, owing to the ongoing conflict in Syria, Krak des Chevaliers remains one of the world's great castles -- and the only one on our list that has experienced (and fortunately survived) 21st-century warfare.
Created in the 12th century by the Knights of St. John, the celebrated Krak is considered the epitome of a crusader castle in the Middle East and one of the greatest statements of medieval military architecture.
The structure features two mighty walls separated by a moat on a steep hillside between Homs and the Mediterranean Sea. The latest UNESCO report on the castle (2019) states that restoration and archeological work has commenced again, but the security situation remains tenuous.
The-CNN-Wire
™ & © 2019 Cable News Network, Inc., a Time Warner Company. All rights reserved.