The trading business gained the Nabataeans considerable revenue, and Petra became the focus of their wealth. The earliest recorded historical reference to the city was when an envious Greek dynasty attempted to ransack the city in 312 BC. The Nabataeans were, unlike their enemies, accustomed to living in the barren deserts, and were able to repel attacks by utilizing the area's mountainous terrain. They were particularly skillful in harvesting rainwater, agriculture and stone carving. The Kingdom's capital continued to flourish until the 1st century AD when its famous Al-Khazneh facade was constructed, and its population peaked at an estimated 20,000 inhabitants.
Encroaching troops of the Roman Empire in 106 AD forced the Nabataeans to surrender. The Romans annexed and renamed the Kingdom to Arabia Petraea. Petra's importance declined as sea trade routes emerged, and after a 363 earthquake destroyed many structures. The Byzantine Era witnessed the construction of several Christian churches. By 700, the city became an abandoned place where only a handful of nomads grazed goats. It remained an unknown place until it was rediscovered by Swiss explorer Johann Ludwig Burckhardt in 1812, sparking renewed interest in the city.
Jordan's most-visited tourist attraction. Tourist numbers peaked at 1 million in 2010, the following period witnessed a slump due to regional instability. However, tourist numbers have picked up recently, and around 600,000 tourists visited the site in 2017.