Some of mankind's earliest habitats were based inside caves. Technological and architectural progression may have made cave structures less common, but our history is littered with incredible buildings carved into caves, cliffs, and mountains.
Here are some of the most amazing examples of cave structures - from castles and strongholds to temples and cities.
1. Petra, Jordan: A 2,000-Year-Old City Carved Into A Mountain
Located in southern Jordan, the ancient city of Petra is one of the world's most famous sites featuring buildings carved into a rockface. Settlement in the area dates back as far as 9,000 BC, and the earliest records of the city are dated 312 BC.
The city is carved into the slopes of Jebel al-Madhbah, a mountain whose rose-colored sandstone gives Petra its iconic shade. The city features tombs, temples, a treasury, and an amphitheater. It has been a UNESCO World Heritage Site since 1985.
2. Predjama Castle, Slovenia: A Beautiful Castle With Hidden Passages
It is said that the castle served as a refuge to the disgraced knight, Erazem Lueger, in the 15th Century. Legends say that Erazem was able to slip in and out of the castle unnoticed, thanks to a narrow passage beneath the building. Today, tourists can climb this passage themselves as they traverse the underground cave system.
3. Ellora, India: Where Religions Coexisted Peacefully
Carved into the basalt cliffs of the Charanandri Hills lie the Ellora Caves, a massive complex of Hindu, Buddhist, and Jain temples and monuments. The structures date from between 600 to 1000 CE.
It is understood that all the temples were built at similar times, revealing a culture of harmony and tolerance in ancient India. The site features 100 caves and was named a UNESCO World Heritage Site in 1983.
4. Hotel Marhala, Tunisia: Try the Cave Life Experience for Yourself
Tunisia's Hotel Marhala allows guests to sleep in what was once an underground town, dating back to the 4th Century. Located near the Sahara Desert, the caves allow residents to keep cool in the intense Summer heat.
Hotel Marhala markets itself on providing a genuine troglodyte experience of living in a cave. The hotel is best known for appearing briefly in Star Wars: A New Hope; and guests can take Star Wars-themed tours in the area.
5. Kropfenstein Castle, Switzerland: An Alpine Mystery
By the end of the 15th Century, the castle was no longer inhabited and began to fall into ruin. Thanks to the protection of a rocky overhang, many parts of the castle still stand, despite their state of disrepair.
6. Lycian Tombs, Turkey: Resting Place of Ancient Kings
Dating back to the 4th Century, some of the most famous Lycian Tombs are located in Dalyan, Turkey. The ancient Lycians are said to have built their tombs on high ground to allow angels to carry the dead to the afterlife.
Dalyan's tombs were the final resting place of the kings of Kaunos. Today, the ornate tombs carved into the cliff-face attract thousands of tourists to the delta.
7. Ruine Puxer-Loch and Castle Schallaun, Austria: Austria's Only Remaining Cave Castles
Located in Styria, Austria the Ruine Puxer-Loch and Castle Schallaun are two castle caves built into the same rock. Records of the Puxer-Loch date back to the 12th Century, whereas dates regarding Schallaun are lesser-known.
The castles were abandoned by the 16th Century but remained in relatively good condition for another 300 years, thanks to the protection of the cave. Schallaun can be visited by climbing the rock face, though there is evidence that there was once a path connecting both castles.
8. Cliff Palace, USA: America's Largest Cliff Dwelling
Located in Colorado, the enormous Cliff Palace was a residential complex set into a sandstone cliff in the Mesa Verde National Park. Evidence suggests that the complex was built, and continually expanded upon, between the 12th and 13th Centuries.
The Cliff Palace was home to the Ancestral Puebloans, a native American people who lived throughout Colorado, Utah, Arizona, and New Mexico. By 1300 the site was abandoned, and it wasn't rediscovered until 1888.
9. Balm Castle, Switzerland: Ruins of a Fortress in an Ancient Cave
Switzerland's Canton of Solothurn is home to the ruins of Balm Castle, a cave stronghold from the mid-11th Century. The natural cave in which it was built measures 66 feet (20 meters) wide and 20 feet (6 meters) deep.
The bulk of the structure was made from wood, which is why so little of it remains today. The site was excavated in both 1939 and 1941, and it was found that the cave had been inhabited by humans since our early history.
10. Ajanta Caves, India: Some of the Best Examples of Ancient Indian Art
Carved into a 250 feet (76.2 meters) wall of rock lie the Ajanta Caves - a series of temples and monuments dedicated to Buddha. The earliest monuments in the area date as far back as the second century BC, and the most recent date back to 480 CE.
Housed within the caves are some of the best surviving examples of ancient Indian art. In 1983 UNESCO named the Ajanta Caves a World Heritage Site.
11. Rappenstein Castle, Switzerland: Built Using the Cave's Natural Walls
Little is known about Switzerland's Rappenstein Castle, other than it was built sometime in the mid-13th Century and operated as a military stronghold. Located within the Cosenz Gorge, the castle consisted of two walls built against the natural walls of the cave.
The castle was abandoned by the late 15th Century and proceeded to fall into ruin. Today tourists can visit the site, where much of the original walls are still standing.
12. Lalibela, Ethiopia: Incredible Medieval Cave Churches
Considered as one of the holiest sites in Ethiopia, Lalibela is best known for its Medieval churches which were cut into the rock. Dating from the 7th to the 13th Centuries, the layout of the churches was meant to be a symbolic representation of Jerusalem.
Situated over 8,200 feet (2,500 meters) above sea level, the churches are an incredible feature of their mountainous surroundings. Today Lalibela attracts many tourists, as well as Christian pilgrims who come to worship at the site.
13. Longmen Caves, China: Thousands of Hand-Carved Caves and Statues
Found in China's Henan province, these 2,345 caves house as many as 100,000 stone statues. The Longmen Caves (sometimes referred to as the Longmen Grottoes) date back to 493 CE and were completed in 1127.
The caves are all manmade, carved into the limestone rock of the Xiangshan and Longmenshan mountains over centuries. They remain an incredible example of Chinese art and sculpture, particularly that of the Tang dynasty.