Shamakhi: Azerbaijan's Ancient Former Capital
Published on 2026-07-22 · 4 min read

About 120 kilometers west of Baku, in the foothills of the Greater Caucasus at an elevation of roughly 730 meters, sits Shamakhi (Şamaxı) — one of the oldest cities in Azerbaijan and, for several centuries, the capital of the Shirvanshah state. Where Baku's history is dominated by 20th-century oil wealth, Shamakhi's runs back more than a thousand years, through waves of destruction and rebuilding that have left the city with a landscape of ruins, restored monuments, and a wine-growing hinterland unlike anywhere else in the country.
Capital of the Shirvanshahs
Shamakhi served as the seat of the Shirvanshah dynasty from as early as the 9th century, at the height of its power as a hub on the trade routes linking the Caucasus, Persia, and points further east. The city's status as capital did not survive intact, however — a catastrophic earthquake in 1191 devastated Shamakhi so severely that Shirvanshah Akhsitan I relocated the seat of power to Baku, beginning that city's long rise. Shamakhi was rebuilt and later reclaimed its role as a regional capital under later rulers and, still later, as capital of the Shirvan Khanate, but it never fully recovered the primacy it held in the early medieval period. Its historical importance is still visible in the layout of the old town and in monuments that predate Baku's own historic core by centuries.
A City Rebuilt Again and Again
Few Azerbaijani cities have been shaped as directly by natural disaster as Shamakhi. Beyond the 1191 earthquake, the city was struck by another major quake in 1667–1668 that killed thousands of residents, and by a further devastating earthquake in 1859 so severe that Russian imperial authorities transferred the provincial capital from Shamakhi to Baku — a second, later echo of the same pattern that had unfolded nearly seven centuries earlier. A subsequent quake in 1872 caused further damage. Each time, the city was rebuilt on or near the same site, and this cycle of destruction and reconstruction is part of what gives Shamakhi's historic core its layered character: monuments here are rarely original in every stone, but represent centuries of continuous repair and restoration rather than abandonment.
Gulustan Fortress
On a hill overlooking the city stand the ruins of Gulustan Fortress (Gülüstan qalası), a defensive stronghold dating to the Shirvanshah era that once guarded Shamakhi against invasion from the surrounding highlands. Much of the fortress today survives only as wall fragments and foundations, but its hilltop position still offers commanding views over the city and the vineyard-covered valleys beyond, and it remains one of the clearest physical reminders of Shamakhi's former strategic importance.
The Yeddi Gumbaz Mausoleums
On a hillside at the edge of town lies Yeddi Gumbaz ("Seven Domes"), a mausoleum complex built as the burial ground for members of the later Shirvanshah dynasty. Of the seven original domed tombs, several were damaged or destroyed over the centuries by the same earthquakes that repeatedly struck the city, and only a handful of domes remain standing today. The site nonetheless functions as one of Shamakhi's most evocative historic landmarks, a quiet burial ground for a ruling dynasty whose capital once stood just below it.
The Juma Mosque and a Deeper History
Shamakhi's Juma Mosque (Cümə məscidi) traces its origins to 743 AD, making it one of the oldest mosques in the Caucasus. Like nearly every historic structure in the city, it has been damaged and rebuilt multiple times over its long history, including major reconstruction after the 19th-century earthquakes, but it remains an active place of worship and a focal point of the old town. A short distance outside Shamakhi, in the village of Maraza, stands the Diri Baba Mausoleum, an unusual two-story rock-cut structure from the 15th century built directly into a cliff face — a striking example of medieval Shirvan architecture that draws visitors making the trip out from the city.
Azerbaijan's Historic Wine Country
Beyond its monuments, the Shamakhi region is significant as the historic heart of Azerbaijani viticulture. The hills around the city, with their moderate elevation, mineral-rich soils, and climate cooler than Baku's coastal heat, have supported grape cultivation for centuries, and the area became a center of organized wine production under Soviet administration, when large state vineyards and processing facilities were established across the district. Local grape varieties and blends from the Shamakhi area remain part of Azerbaijan's wine identity today, and vineyards are a defining feature of the landscape driving into and around the city — terraced rows climbing the same slopes once fortified against invasion.
A Feasible Trip from Baku
Unlike Azerbaijan's more distant historic cities — Sheki is roughly a four-and-a-half-hour drive from the capital, Ganja further still — Shamakhi's proximity to Baku sets it apart. The drive along the Baku-Shamakhi highway takes around two hours under normal conditions, comfortably within range of a day trip and well suited to a weekend visit. That accessibility, combined with a genuinely ancient historic core, cooler hill-country air, and a wine-growing landscape found nowhere else so close to the capital, has made Shamakhi an increasingly familiar name to Baku residents looking for a short escape rather than a long-haul domestic trip.