(CNN) — A place for cleansing and contemplation, for relaxation and conversation.
In the days of the shahs, the khans and even the Russian Empire, hammams in Azerbaijan were about much more than just getting clean.
"People got together, chatted, discussed. It was a social institution where you would relax and, everything that had built up inside of you, you'd talk about it and share it," says Kamil Ibragimov, head of the archaeological department in Baku's Old City administration.
Spiritual and physical needs
Azerbaijani cities in the Middle Ages were separated into small neighborhoods known as mehelle and each one had its own hammam and mosque, catering to both the spiritual and physical needs of local Muslims.
The hammam also played a key role in marriage. Long before the Soviets did away with religious conservatism, women's hammams were a natural hunting ground for mothers eager to get a closer look at potential young brides. Men on the other hand used the hammam to strike deals over tea and games of nard, the local version of backgammon.
Azerbaijan's hammams are strictly single sex.
Tom Marsden
Above all, though, hammams were historically a means of maintaining public hygiene.
In the days of the Silk Road, for example, a hammam stood at both entrances to Baku's Old City and travelers could only enter after burning their old clothes and having a good scrub.
Hammam culture dipped a little in Soviet times as apartments were increasingly fitted with their own baths and showers, but hammams were still the first port of call whenever there was a water crisis.
Today there's still a loyal crowd of locals that can't live without a hammam, but before joining them here's a brief guide to its rules and rituals.
How to hammam
1. Male or female: Hamams in Azerbaijan are strictly segregated: Some are just for men, some for women and some for both but on different days. While this segregation rule has relaxed a little since the Middle Ages -- some male hammams now employ masseuses -- mixed bathing is still a complete no-no.
2. Wear a towel: As opposed to Russian "banyas" and Finnish saunas and despite the segregation rule, strutting around completely naked is not allowed. Instead a special towel called a fite must be worn at all times.
3. Be whipped: Given the former Russian influence over the Caucasus it's no surprise that bushy and aromatic birch twigs have also found their way into the Azerbaijani hammam.
Being lightly whipped by a companion in the parkhana, or steam room, stirs up the heat and aids breathing and circulation.
4. Scrub hard: Central to the Azerbaijani hamam ritual is kise, in which a person called a kisechi scrubs all the grime from your body using a large abrasive glove. It may feel a little forceful at first, but will leave a light tingle across the body.
5. Steam room etiquette: A felt hat should also be worn to insulate you (and your hair) and prevent overheating. Scrubbing in the steam room is strictly prohibited.
6. Foamy soap: Another interesting ritual is something called kurpuk. Soap and water are whisked together with a special net to create big clouds of soapy foam which the kisechi rubs over every inch of your body.
7. Coffee, salt and honey: Another procedure is rubbing salt, coffee and honey into the skin. The salt helps you sweat, the coffee is aromatic and the honey soothes any wounds and inflammations.
8. Take your time: The bathing process itself shouldn't be rushed, but equally important is drinking tea afterward. There's no time limit on how long you can spend at the hammam so it's not unusual to sit, scrub and socialize over six to eight hours.
9. Admire the architecture: Azerbaijan's old hammams were built in the Eastern style common across Iran, Central Asia and the Middle East. A key feature is the cupola with holes at the top, superbly engineered to let air out but not let rainwater in. Older hammams were often built half-underground, keeping them warm in winter and cool in summer.
Most of Azerbaijan's old hammams stopped functioning a long time ago. Some are preserved as monuments while others have been converted into shops, bazaars or tea houses. But there are still a few places in central Baku to experience the steamy rituals of the past.
Agha Mikayil Hamami
This is the number one choice for a quintessential Azerbaijani hammam experience. Built in the 18th century, Agha Mikayil is Baku's oldest functioning hammam. It operates separate days for men and women and is run by an enthusiastic team with lots of experience.
Given its timeless appeal, Agha Mikayil has been used several times as a film location. A hammam scene from the 1956 film "If Not This One, Then That One" is especially popular.
Women's days are Mondays and Fridays, all the rest are for men. Basic entrance is just 10 manats (around $6), including limitless access to the steam room, showers and pool. Extra services cost as follows: body scrub -- 10 manats; coffee, salt and honey treatment -- 20 manats; massage -- 20 manats.
Agha Mikayil Hamami, 16, Kickik Qala, Icheri Sheher, Baku; +994-50-345-21-44
Agha Zeynal Hamami
Agha Zeynal Hamami (also known as Prestige) dates back to Baku's late 19th-century oil boom. This was originally a men's hammam, switched to being women-only during the Soviet era, and is now once again exclusively for men.
Today this hammam has a local clientele, offers all the traditional treatments and still breathes the spirit of the past.
Prices: entrance (including steam room and baths) -- 12 manats; 30-minute massage -- 15 manats; the full package costs about 60 manats ($35).
Agha Zeynal Hamami, 5 Saftar Quliyev Street, Icheri Sheher, Baku; +994-55-639-19-99 // +994-55-434-65-35
She-Bi Hamami
Elegant detailing at She-Bi Hamami.
Tom Marsden
This 19th-century hammam -- known until recently as Gasim Bey Hammam, after its millionaire founder Gasim Bey -- was exclusively for women for most of its existence.
It's now a men-only hammam and is especially popular with civil servants, thanks to its location near four government ministries.
The main attractions are its elegant central pool and a locals-only feel. It offers all the usual procedures (steam room, whipping, pool, scrub, mochalka -- a smoothing wash with soap -- and massage), plus there's an in-house barber, café and a booth for pedicures.
Prices are 12 manats for entrance (includes unlimited time in the steam room and pool); 12 manats for scrubbing, 20 manats for an hour-long massage.
She-Bi Hamami, 41 Murtuza Mukhtarov Street, Baku; +994-50-540-08-41
Akhund Hammam
Further along Murtuza Mukhtarov Street is a great example of the age-old link between mosques and hammams. Almost opposite the green-domed Haji Sultan Ali mosque is the men-only Akhund Hammam, named in honor of the akhund (cleric) that lobbied for its construction way back in 1887.
Prices: entrance and use of the sauna -- 10 manats; a 30-minute scrub -- 12 manats; and a 30-minute massage -- 14 manats.
Akhund Hammam, 141 Murtuza Mukhtarov Street; +994-12-595-50-59
Tezebay Hammam
For Tom Marsden's story about Azerbaijan hammams (CNN Travel sponsorship: Destination Azerbaijan)
Tom Marsden
This hammam's building may date back to 1886, but it's only been functioning as a hammam for the last 20 years. The eclectic mix of souvenirs, stuffed animals and dim lighting create a wacky ambiance and make the place feel part hammam, part museum. Look out for the portraits of Lenin and Stalin and the small statue of Donald Trump.
While less historic, its services and equipment are a little more upmarket. This is reflected in the prices - 23 manats covers entrance while the average all-inclusive package is 86 manats. This includes Russian, Turkish and Finnish saunas, pool and baths, body scrub, a half-hour massage and veniki (birch-twig whipping).
Tezebay is especially popular with stag and hen parties. Men's and women's hammams are housed in adjacent buildings.
Hemişə temizlikde! Enjoy your bath.