Shamakhi is one of those towns whose quiet present hides a glorious past. Surrounded by vineyards on the slopes of the Greater Caucasus, a couple of hours from Baku, for almost a thousand years it was the capital of the kingdom of Shirvan, one of the most powerful and refined states of the medieval Caucasus, and one of the richest cities on the entire Silk Road. Poets, merchants and ambassadors passed through, and its name was known in Baghdad, Tabriz and Venice. Earthquakes and invasions struck it again and again, but Shamakhi always rose back up.
Today, gems from that splendour remain and are well worth seeking out: the Juma Mosque, from 743, one of the oldest in the Caucasus, rebuilt after every earthquake; the Seven Domes mausoleum, Yeddi Gumbez, where the last khans of Shamakhi rest, its domes outlined against the sky; and, nearby, the enigmatic Diri Baba mausoleum, set into a cliff face. Add to that the region's winemaking tradition, with wineries you can visit, and the Pirgulu astronomical observatory up in the mountains.
This guide helps you plan your visit: what to see in the town and around it, how to get there from Baku, what things cost, where to taste Shirvan wine and how to combine Shamakhi with other destinations in the interior. It's a perfect trip from the capital for anyone who wants history, wine and mountains, and to discover the heart of old Shirvan.
For centuries Shamakhi was the capital of the kingdom (or khanate) of Shirvan, a state that dominated the eastern Caucasus from the Middle Ages, ruled by the Shirvanshah dynasty. Its position on the Silk Road made it rich and famous: merchants and poets frequented it, and its Juma Mosque, from 743, is among the oldest in the Caucasus. The town suffered devastating earthquakes and conquests by Persians, Ottomans and Russians, which destroyed and rebuilt it again and again; the capital of Shirvan was even moved to Baku because of the earthquakes. In the 18th century it was the centre of the Shamakhi Khanate, whose last khans rest in the Yeddi Gumbez mausoleum, and in the 19th it passed to the Russian Empire. Earthquakes such as those of 1859 and 1902 flattened it once more. This story of splendour, earthquakes and rebirths of old Shirvan is told on our history page.
Read the full history ↓Azerbaijan's historic heartland: Ganja, city of the poet Nizami; Shamakhi, capital of the old kingdom of Shirvan, with one of the oldest mosques in the Caucasus; and unusual Naftalan, where the signature treatment is a bath in crude oil.
Read the history of The centre: Ganja, Shamakhi and Naftalan →A local guide tells you in half an hour what no sign at the site will ever explain. We look ours up on Civitatis: guided in Spanish and booked online with no fuss. They have 9 activities in Baku. And there are free tours here: you book without paying and tip the guide whatever you think at the end, so trying one costs you nothing. Have a look below: tap any of them to see them all.
They depart from Baku, 109 km away. If you book from this link we earn a commission and you pay no more.
No exact prices: a scale from $ (budget) to $$$$$ (luxury), with 2-3 options per category.
Origins, formation and what the sources say.
It's hard to picture today, strolling through its quiet streets among the vineyards, but for almost a thousand years Shamakhi was one of the most important cities in the Caucasus: the capital of the kingdom of Shirvan, a state that dominated the east of the region from the early Middle Ages and whose name was known at the courts of Baghdad, Tabriz and even Venice. Merchants, poets, ambassadors and pilgrims passed through, drawn by its wealth and its position on the Silk Road.
Shamakhi's secret was its location: on the slopes of the Greater Caucasus, at the crossroads of the routes linking the Persian and Mediterranean worlds with Central Asia and the northern steppes. That position made it rich in silk, textiles and trade, but it also turned it into a coveted prize and a constant target for invasions. On top of that came a geological curse: Shamakhi sits in one of the most seismically active zones in the country, and earthquakes destroyed it again and again over the centuries.
The story of Shamakhi is, therefore, a story of splendour and resilience: a city that was great, that was flattened dozens of times by earthquakes and armies, and that always rose again. Its surviving monuments (the old mosque, the mausoleums) bear witness to that long memory of old Shirvan.
The Shamakhi area has been inhabited since very ancient times, and in Antiquity it was already part of Caucasian Albania, the Christian kingdom of the eastern Caucasus (unrelated to Balkan Albania). But the founding moment of historic Shamakhi came with the Arab conquest and the spread of Islam in the 8th century. It was then, in 743-744, that the Juma Mosque of Shamakhi was built, one of the oldest in the whole Caucasus, second only to the one in neighbouring Derbent.
That mosque, with its unusual layout of three prayer halls, is the city's oldest material testimony and a symbol of the early arrival of Islam in the region. Over the centuries it would be destroyed and rebuilt many times (by earthquakes, fires and wars), but always on the same sacred site, so the current mosque, the result of a major recent restoration, has its roots in that 8th-century building.
Under the rule of the caliphates and the Muslim dynasties that followed, Shamakhi grew as an urban, commercial and religious centre. Little by little it took shape as the capital of a political entity of its own, Shirvan, ruled by a local dynasty that would go down in history under the title of Shirvanshahs, 'the kings of Shirvan'.
During the Middle Ages, Shamakhi was the capital of the kingdom of Shirvan, ruled by the Shirvanshah dynasty, one of the longest-lasting in the Islamic world: with ups and downs, its rulers governed the region for centuries. Under their rule, Shirvan was a prosperous and cultured state that managed to keep a degree of autonomy from the great neighbouring empires through diplomacy, alliances and, when necessary, force of arms.
Shamakhi then reached its peak. It was a city rich in silk (the region was famous for its textiles), with bazaars, caravanserais, mosques and a cosmopolitan atmosphere fed by Silk Road trade. The Shirvanshahs' court attracted poets and scholars; the most famous poet linked to the city was Khaqani, a great figure of 12th-century Persian poetry. Culture, trade and political power went hand in hand in the capital of Shirvan.
Over time, however, Shamakhi itself proved vulnerable to earthquakes, and at various points the Shirvanshahs moved their residence to the safer city of Baku, where they built the famous Palace of the Shirvanshahs, now a UNESCO World Heritage Site. Even so, Shamakhi remained the economic and symbolic heart of the kingdom, the city that gave its name and meaning to all of Shirvan.
From the 16th century onwards, the kingdom of Shirvan lost its independence and was caught in the long struggle between the region's two great empires: Safavid (Shia) Persia and the (Sunni) Ottoman Empire. Shamakhi changed hands several times, and with each conquest it suffered looting and massacres. The city, which at its height had been one of the most populous in the Caucasus, entered a period of instability and decline.
One of the hardest blows came in 1721, when the city was stormed and sacked amid the upheavals shaking Persia; that episode, in which the foreign merchants in the city suffered too, even had international diplomatic repercussions. In the 18th century, as central Persian power crumbled, the Shamakhi Khanate emerged, a small local state ruled by its own khans, whose mausoleums (the Yeddi Gumbez, 'the seven domes') still crown a hill on the outskirts.
At the start of the 19th century, the Russian Empire annexed the eastern Caucasus after its wars with Persia, and Shamakhi passed into the tsars' domain under the treaties of Gulistan (1813) and Turkmenchay (1828). Under Russian administration, the city was for a time a provincial capital, but its history was still shaped by the constant threat of the ground trembling beneath its feet.
No history of Shamakhi is complete without its earthquakes. The city sits on one of the most seismically active zones in Azerbaijan, and over the centuries it was destroyed by devastating quakes on many occasions. Each time, much of the city was left in ruins, with thousands dead, and each time the survivors rebuilt it on top of the rubble.
In the 19th century, two major earthquakes sealed its fate. The 1859 quake was so destructive that the Russian authorities decided to move the provincial capital to Baku, a blow from which Shamakhi never recovered as a political centre. And the 1902 quake flattened the city once more, bringing down the Juma Mosque again along with many of its buildings. That's why very few truly old buildings are still standing today: almost everything you see is reconstruction on top of reconstruction.
This relationship with earthquakes explains how Shamakhi looks today (a city with a fairly modern feel despite being thousands of years old) and also its character. The ruined mausoleums of Yeddi Gumbez, with only some of their domes still standing, are the most telling image of that struggle between human work and the force of the earth. Shamakhi is, quite literally, a city rebuilt on its own memory.
In Soviet times, Shamakhi was a quiet provincial town, with its farming, its vineyards and, from the 1960s, the large Astrophysical Observatory built in the nearby mountains at Pirgulu, which takes advantage of the area's clear skies. With Azerbaijan's independence in 1991, the city kept that calm profile, far from Baku's oil-fuelled frenzy, relying on agriculture and, increasingly, on tourism.
Today, Shamakhi has reinvented itself as a destination for history, wine and nature. The monumental restoration of the Juma Mosque gave the city back its oldest jewel; the Yeddi Gumbez mausoleum and the nearby, spectacular Diri Baba draw visitors; and the winemaking tradition, the most important in the country, is thriving again with modern wineries offering tours and tastings among the mountain vineyards. Its altitude also makes it a cool refuge from the heat of the coast.
For travellers, Shamakhi is one of the best day trips from Baku: in a single day you can touch the thousand-year history of old Shirvan, taste the wine from its hills and breathe the air of the Caucasus foothills. Behind its provincial calm beats the memory of a capital that was once great, that the earth knocked down dozens of times and that, stubbornly, always rose again. Few cities tell the long and turbulent story of Azerbaijan so well.