As the plane starts its descent into Baku, circling over the Caspian sea, a column of flame leaps up in the darkness. Far away from the lights of the city, it probably comes from an oil rig, burning off natural gas as it drills into the sea bed. We pass overhead, the orange glow receding under the wing, and I sink back into my seat, slightly disconcerted by what I have seen. In ancient times the people of Azerbaijan worshipped fire, the legendary prophet Zoroaster starting a religion here that spread throughout central Asia. Alexander the Great, the first of a long line of foreign conquerers, named his Caucasian province Atropatena, 'protected by fire'. Though Alexander's troops were followed by Arabs, Seljuk Turks, Mongols, Persians and the Soviet Red Army, each bringing their own laws and religions, fire was always the element that governed this country's destiny. Even in the twenty-first century, Azeri weavers still knot buta, ('paisley' fire symbols) into their carpets, and the emblem of the post-Soviet Azerbaijan Republic is a flame, outlined against an eight-pointed star.
Drive from the airport through Baku's endless suburbs, and the source of the flame gradually becomes apparent. The first clue is a piece of kitsch; on a traffic island is a replica drilling derrick, gaily decorated with fairy lanterns. Then you notice the petrol stations, an improbable number of them, oases of white light and primary-coloured plastic panelling which stand out incongruously against the drab tenements. Little by little, the new shanty towns are replaced by stark Soviet modernist blocks. Then the blocks themselves segue into Hausmannesque streets of grand mansions, which are the biggest clue of all. These pompous edifices, with fauns and caryatids holding up their ornate facades, make up what the locals know as 'Boom Town'. A hundred years ago, Baku was the centre of one of the greatest money-making frenzies the world has ever known. Early travellers had reported that oil lay on the ground in huge pools, and spouted hundreds of feet into the air, so that crossing the Apsheron pensinsula was like walking on the back of "a huge spermaceti whale". The invention of the internal combustion engine brought prospectors from all over the world. Anyone who had the luck to strike a gusher and the technical skill to cap it could make themselves an instant millionaire. Alfred Nobel laid the foundations of his fortune here, and the Rothschilds built a mansion which now houses the State art gallery. By 1910 Baku was producing more than half the world's oil, and a non-stop party of jazz bands, Packard motor cars, international intrigue and conspicuous consumption of the conveniently-local Beluga caviar was underway. The Red Army brought the fun to an abrupt end in 1918, and Baku became one of the keys to the Soviet Union's economic strategy. Hitler, aware of this, was heading here when he ran into the horrors of the Russian Winter. "Oil," as one Azeri tells me simply, "is the blood of this place."
The best way to understand what has happened to Azerbaijan since the end of the Soviet era is to climb the steps up from the waterfront to the Shahidar Hiyabany. Here, under the eye of one of the towering communications masts which the Soviets erected over so many cities, is an area which was once a pleasure park and funfair. Now it is known as Martyr's Lane, in memory of 20th January 1990 when the Russians, desperate to stop the imminent secession of a vital part of their empire, sent tanks onto the streets of Baku. A hundred citizens were massacred and Azerbaijan became independent anyway. The new government decided to build a monument to the dead, a low-key affair of variegated marble slabs. Tragically, this has been joined by thousands of other graves, polished black headstones etched with images of their occupants, the dead of the Nagorno-Karabagh war against Armenia. This consequences of this conflict, partly-resolved by a 1994 ceasefire, can be felt throughout Baku. The city, whose official population is a million and a half, is now estimated to hold up to five million people - the refugees, the 'internally displaced' of the war, and many others whose livelihoods were destroyed by it or by the collapse of the Soviet Bloc economy, and who have left the regions to hunt for work in the capital. They live in the suburbs, with poor access to water, sanitation and electricity. One of the cruellest ironies of Azeri life is the frequency of power cuts in a country literally brimming with fuel.
Despite the troubles, there is money in Baku. Shops sell DVD players and Japanese white goods. The news stands display rows of Russian glossy magazines, and shining 4x4's weave between the lines of grubby Ladas along the promenade. New contracts have been signed with petrochemical multinationals, and natural gas fields have been discovered in Azerbaijan's sector of the Caspian. There is an expectant air, as if, after an eighty year interval, the big party might begin again. Chechen gangsters shop for suits in Fountains square and British oilmen line up at the bar of the Britannia pub, sinking pints with air crew and embassy staff. Drinks are paid for in dollars, and hangovers are dragged home to company flats in the mansions built by the first generation of oil barons. Recently Baku's mediaeval old town was paid the ultimate capitalist compliment, when the producers of the latest James Bond film decided to shoot several scenes there. Now if you walk into any of the city's more expensive restaurants, you will be greeted by a framed photo of the beaming owner shaking hands with Pierce Brosnan.
The old town, as glimpsed in The World Is Not Enough, was a mysterious souk populated by knife-wielding orientals and oily Levantines. Stripped of Bond's dramatic lighting and consumer glamour, it is a pleasant maze of winding streets, the crumbling houses fronted by ornamental wooden balconies. Old men play dominoes at café tables and urchins charge around playing hide and seek. This is a place to shop for a carpet or an astrakhan hat (so long as you're able to forget you're wearing the wool of a foetal lamb on your head), soak in the old hamam, or just hang around, copying the innumerable cats who sun themselves on steps and porches. On the highest point of the old city is the palace of the Shirvanshahs, who ruled Baku when it was still a seaside backwater. Its mosques and mausoleums are empty now, but it is still possible to glimpse what it must once have been, stepping into secluded courtyards shaded by lime and olive trees, small versions of the garden paradise which awaited the khans in the next life. Nearer the waterfront is the Maiden Tower, a mysterious and ancient fortress, probably built as a lookout post as long ago as 500BC. With its shadowy niches and alcoves, it has become immensely popular with Baku's frustrated young lovers. As you climb up its seven storeys, couple after couple spring apart, pretending that they were just examining the stonework.
In the days of the first oil boom, Baku was divided into white and black cities, the clean quarter where the oil barons had their mansions, and the dirty one where the work itself took place. Conditions were terrible, and a young Georgian agitator, Iosep Dshugashvili, cut his teeth fomenting unrest among the workers. Dshugashvili changed his name to Stalin, and the black city has gone, but a century and a half of oil drilling has changed the landscape around Baku irreversibly. Apsheron is now a huge pitted plain, dotted with thousands of oil derricks, some rusting wrecks from the last century, some still pumping crude today. It is an awesome, eerie landscape, like a mechanical petrified forest. The oxidising skeletons of railway carriages slip slowly into pools of black sludge, and unidentifiable tangles of metal litter the ground. The towering iron frames march off towards the Caspian, not stopping at the shore, but wading out into the water like a party of pylons on a daytrip to the seaside.
The industrial landscape to the south of Baku is equally bleak and fascinating. The Soviets decided that this was the place to centralise all petrochemical byproduct production for the entire USSR. All along the coast, vast factories are linked together by pipelines which run along the road, sometimes leaping over it, sometimes branching off into tiny sub-pipes that criss-cross the scrubby desert without apparent rhyme or reason. Like so much else, this industry has collapsed, and these factories are now working at as little as three percent capacity. The whole area is silent and ghostly, a monument to the grandiose lunacy of Soviet state planning. In the midst of the desolation are towerblock towns like Sahil (or 'Seaside'), a place so grim that passing travellers can be heard giving thanks that they do not have to live there. There are also surreal beach places with names like the "Eldorado" and "Caspian Paradise" where you can sit under a straw umbrella and stare out at the rigs on the iron-grey sea.
Away from the industrial zones, much of Azerbaijan is very beautiful. The rocky land of Gobustan is famous for its neolithic rock drawings. Figures of hunters and animals are carved into the boulders, and Gurban Aleskerov, the director of the little archaeological museum, is usually on hand to act as guide. His enthusiasm is infectious. "Look," he says to me, grabbing my arm and pointing up at a group of earth goddess figures. "It is like American playboy." Then he checks himself. "At least this is my imagining."
Around Quba, towards the Daghestani border to the North, the country rises and becomes greener. The area is famous for its orchards, and towards the mountains there is good hiking in forests which are home to deer and wild boar. In the countryside I get lost, and wind up at the top of a muddy track by the village of Alpan. A local man takes me past the ruins of the collective farm where the villagers had to live during Stalin's time, to a field overlooking a lush valley. Here, buried along the crest of the ridge, are local men who died fighting the Red Army in 1918. By the tall gravestones are the tumble-down brick remains of a Zoroastrian fire temple, and a huge oak tree to which thousands of coloured rags have been pinned. When people wish to propitiate the spirit of the place, they tear a strip from their clothing, and attach it to the tree. It is clear that, in Alpan at least, Zoroastrianism, Islam and Dialectical Materialism only glossed over far more ancient beliefs .
Back in Baku, I go dancing at the 1033 nightclub. The city's gilded youth shimmy along to the sound of an American band playing synthesiser soul covers (Lionel Ritchie, Debarge, Chic) while a giant video screen projects Russian swimsuit videos. The boys wear suits, the girls go for big hair and shoulder pads. All it needs is Michael Douglas in a bad jumper and the eighties ambience will be complete. Is this the future for Azerbaijan? Perhaps, as long as the oil holds out, and politics doesn't get in the way. President Aliyev is ill, and the succession is in question. I order another vodka and remember what the young tour guide told me. "We bless theoil. It gives you a kind of hope. Oil will be the tank that pushes the way through for a kind of equality." Up at the Shahidar Hiyabany the eternal flame goes one burning, in memory of the dead.