She was an archaeologist, a linguist and the greatest woman mountaineer of her age. And in Baghdad in 1921 she drew the boundaries of the country that became Iraq. James Buchan on the extraordinary life of Gertrude Bell

In British diplomatic group photographs of the early 20th-century Middle East, amid the plumes and uniforms and the calm paraphernalia of an empire going to hell in a bucket, there is often a solitary female. The woman is slim, with a head of luxuriant hair, and neatly dressed in billowing muslins or in the pencil silhouette and cloche hats of jazz-age Baghdad.

The woman is Gertrude Bell, who is as responsible as anybody for the rickety national state first known as Mesopotamia, and now as Iraq. As a powerful official of the British administration in Baghdad after the first world war, Bell ensured that an Arab state was founded from the three Ottoman provinces of Mosul, Baghdad and Basra, but one which was too weak to be independent of Britain. "I had a well-spent morning at the office making out the southern desert frontier of the Iraq," she wrote to her father on December 4 1921.

One of Oxford University's most brilliant students, the greatest woman mountaineer of her age, an archaeologist and linguist, passionate, unhappy and rich, Bell saw in Arab male society, and what US President Woodrow Wilson called "the whole disgusting scramble" for the Middle East after the first world war, opportunities that were unthinkable at home.

John Buchan, in his novel Greenmantle (1916), and TE Lawrence in his guerrilla exploits in Arabia the following year, made popular a myth that an Englishman could become an Arab - only more so. To her generation in Britain, Bell went one better. She seemed to move as an equal among the sheikhs without compromising her British femininity. Her letters to her father and stepmother, one of the great correspondences of the past century, pass easily from orders for cotton gowns at Harvey and Nichols [sic] to the new-fangled British air warfare being tried out on recalcitrant Iraqi Arabs and Kurds.

The historical waters have closed over TE Lawrence. Even back in the 70s, I could find nobody with any recollection of him at the scenes of his exploits in western Arabia. But "Miss Bell" is still a name in Baghdad. Even in conversations with the vicious and cornered cadres of Saddam Hussein's regime, her name will come up to evoke, for a moment, an innocent Baghdad of picnics in the palm gardens and bathing parties in the Tigris.

Yet Bell and her superior as British high commissioner, Sir Percy Cox, laid down policies of state in Iraq that were taken up by Saddam's Arab Ba'ath socialist party. Those policies were to retain, if necessary by violence, the Kurdish mountains as a buffer against Turkey and Russia; to promote Sunni Muslims and other minorities over the Shia majority; to repress the Shia clergy in Najaf, Kerbela and Kazimain, or expel them to Iran; to buy off the big landowners and tribal elders; to stage disreputable plebiscites; and to deploy air power as a form of political control. "Iraq can only be ruled by force," a senior Ba'ath official told me in 1999. "Mesopotamia is not a civilised state," Bell wrote to her father on December 18 1920.

The Ba'ath is facing extinction. Any US civil and military administration in its place will have the precedent of Bell's 1920 white paper (typically, the first ever written by a woman), Review of the Civil Administration of Mesopotamia. Sixteen volumes of diaries and about 1,600 letters to her parents, transcribed and posted on the web by the University of Newcastle library (www.gerty.ncl.ac.uk) are a must-read at the Pentagon, less for their portrait of an oriental culture in its last phase as for their perilous mingling of political insight and blind elation.

Gertrude Margaret Lowthian Bell was born on July 14 1868 in Washington, Co Durham. Her family were ironmasters on a grand scale, with progressive attitudes. In 1886, Bell went up to Lady Margaret Hall, Oxford, where she was the first woman to win a first-class degree in modern history. Unwanted in the marriage market - too "Oxfordy" a manner, it was said - she taught herself Persian and travelled to Iran in 1892, where her uncle was British ambassador.

She wrote her first travel book, Persian Pictures, and translated the libertine Persian poet Hafez into Yellow Book verse. She also fell in love with an impecunious British diplomat, who was rejected by her father. Though she was to form passionate attachments all her life, she kept them under rigid formal restraint.

The next decade she killed in two round-the-world journeys and in the Alps, where she gained renown for surviving 53 hours on a rope on the unclimbed north-east face of the Finsteraarhorn, when her expedition was caught in a blizzard in the summer of 1902. She had begun to learn Arabic in Jerusalem in 1897, wrote about Syria, and taught herself archaeology. She immersed herself in tribal politics and in 1914 made a dangerous journey to Hail, a town in northern Arabia that was the headquarters of a bitter enemy of Britain's new ally, the founder of Saudi Arabia, Abdul Aziz ibn Saud.

With the outbreak of war that summer, and the entry of the Ottoman empire on the side of Germany that November, Bell was swept up with TE Lawrence and other archaeologist-spies into an intelligence operation in Cairo, known as the Arab Bureau. In Iraq, an expeditionary force from India had surrendered to the Turks at Kut al-Amara on the lower Tigris in 1916. Bell travelled to Basra, where a new army was assembling. When Baghdad fell to the reinforcements in 1917, she moved up to the capital and was eventually appointed Cox's oriental secretary, responsible for relations with the Arab population.

British policy in the Middle East was in utter confusion. While the government of India wanted a new imperial possession at the head of the Persian Gulf, London had made extravagant promises of freedom to persuade the Arabs to rise up against the Turks. The compromise, which was bitterly resented in Iraq, was the so-called League of Nations Mandate, granted to Britain in 1920.

Senior Indian officials, such as the formidable AT Wilson, argued that the religious and tribal divisions in Iraq would for ever undermine an Iraqi state. Bell believed passionately in Arab independence and persuaded London that Iraq had enough able men at least to provide an administrative facade. But she had two blind spots. She always overestimated the popularity of Cox and herself, and she underestimated the force of religion in Iraqi affairs and the Shia clergy "sitting in an atmosphere which reeks of antiquity and is so thick with the dust of ages that you can't see through it - nor can they".

On June 27 1920, she was writing: "In this flux, there is no doubt they are turning to us." In fact, the Shia tribes of the entire middle Euphrates rose in revolt the next month, and hundreds of British soldiers and as many as 8,000 Iraqis were killed before it could be suppressed. The next spring, Winston Churchill called a conference in Cairo, where Bell - the only woman among the delegates - had her way. The Hashemite Prince Faisal, a protege of TE Lawrence who had been ousted by the French in Syria, was acclaimed King of Iraq in a referendum that would not have shamed the Ba'ath. The "yes" vote was 96%. In place of the mandate, an Anglo-Iraqi treaty was railroaded through the Iraqi parliament.

Bell was carried away. "I'll never engage in creating kings again; it's too great a strain," she wrote with uncharacteristic vanity. She fell prey to Iraqi flattery and was given the nickname Khatun, which means fine lady or gentlewoman. "As we rode back through the gardens of the Karradah suburb," she told her father on September 11 1921, "where all the people know me and salute me as I pass, Nuri [Said] said, 'One of the reasons you stand out so is because you're a woman. There's only one Khatun... For a hundred years they'll talk of the Khatun riding by.' I think they very likely will."

Yet she could also attend a display of the force being deployed by the RAF on the Kurds around Sulaimaniya: "It was even more remarkable than the one we saw last year at the Air Force show because it was much more real. They had made an imaginary village about a quarter of a mile from where we sat on the Diala dyke and the two first bombs dropped from 3,000ft, went straight into the middle of it and set it alight. It was wonderful and horrible. Then they dropped bombs all round it, as if to catch the fugitives and finally fire bombs which even in the brightest sunlight made flares of bright flame in the desert. They burn through metal and water won't extinguish them. At the end the armoured cars went out to round up the fugitives with machine guns."

Bell was never liked, either in London or New Delhi, and when Cox left Baghdad in 1923, she lost her bureaucratic protector. She devoted more of her time to her old love, archaeology, and established the Baghdad Archaeological Museum which, remarkably, has survived. Her letters home were more and more dominated by illness and depression. On Monday July 12 1926, quite suddenly, Gertrude Bell died.

The official story was that years of gruelling work in the 49C (120F) heat of the Baghdad summer had proved too much for "her slender stock of physical energy". In fact, she took an overdose of sleeping pills, by accident or by intention. She is buried in Baghdad.

Thanks to crude oil, found in commercial quantities at Kirkuk in 1927, the little Iraqi monarchy survived Turkish intrigue, Saudi aggression and repeated uprisings, the worst in 1941 when pro-German officers drove the king and Nuri Said, the prime minister, into exile. But the collapse of British power and prestige at Suez in 1956 marked the end of the road. Faisal II and the royal family were murdered in a republican coup d'etat on July 14 1958.

The Iraq of Gertrude Bell had lasted 37 years. The Ba'ath finally seized power in 1968, built a prosperous despotism in the 1970s but destroyed itself and the country in hopeless military adventures in Iran in the 1980s and Kuwait in 1990. As of yesterday, Ba'athist Iraq had lasted 35 years.

Bell's letters home

Whenever there was snow we sank in it up to the waist... I nearly took a straight cut on to the glacier, for I slipped on a bit of iced rock into a snow gully till the rope fortunately caught me. We all cut our hands over that incident, but it was otherwise the most comfortable part of the descent.

The Alps, 18 July 1902

Such an arrival! Sir Percy made me most welcome and said a house had been allotted to me... a tiny, stifling box of a place in a dirty little bazaar. Fortunately, I had not parted from my bed and bath. These I set up and further unpacked one of my boxes which had been dropped into the Tigris and hung out all the things to dry on the railing of the court.

Baghdad, April 20 1917

I don't think I shall ever be able to detach myself permanently from the fortunes of this country.... it's a wonderful thing to feel the affection and confidence of a whole people round you. But oh to be at the end of the war and to have a free hand!

Baghdad, May 26 1917

Until quite recently I've been wholly cut off from [the Shias] because their tenets forbid them to look upon an unveiled woman and my tenets don't permit me to veil... Nor is it any good trying to make friends through the women - if they were allowed to see me they would veil before me as if I were a man. So you see I appear to be too female for one sex and too male for the other.

Baghdad, March 14 1920

Have I ever told you what the river is like on a hot summer night? At dusk the mist hangs in long white bands over the water; the twilight fades and the lights of the town shine out on either bank, with the river, dark and smooth and full of mysterious reflections, like a road of triumph through the midst.

Baghdad, September 11 1921

· James Buchan has reported from the Middle East since the 70s.