It sounds like the plot for some cheesy sci-fi novel: a global catastrophe is averted by a brilliant scientist who gains worldly riches but loses his soul. Yet such is the story of a breakthrough last week hailed as arguably the most important of the 20th century. Exactly a century ago this month, the German chemist Fritz Haber patented an invention that saved the world from a truly apocalyptic calamity. Today, the fruits of his genius still support the lives of around half the world's population. Haber himself enjoyed all the trappings of success, including a Nobel Prize. But by the time he accepted this ultimate scientific accolade, his life was showing disturbing parallels to the legend of Dr Faust, the medieval German sorcerer who sold his soul to the devil in exchange for power.
The origins of Haber's Faustian pact lay in a chemical reaction routinely taught in schools today. Known as the Haber process, it gave mankind access to virtually limitless supplies of the chemical crucial for feeding the world: nitrogen. Around the turn of the last century leading scientists were warning that a dire prediction made a century earlier was in danger of coming true. In 1798, the English economist Thomas Malthus had argued that the world must eventually be unable to feed itself because of a simple fact of arithmetic. His reasoning was that populations tend to grow at an exponential rate - that is, like the sequence 1, 2, 4, 8, 16, and so on - whereas food supplies increase only linearly, as 1, 2, 3, 4 etc.
The implication was clear: eventually there would not be enough food to feed everyone, triggering global starvation. The only hope for averting this catastrophe lay in finding some way of boosting crop yields. Farmers knew one approach was to use fertilisers rich in nitrogen, but scientists warned that the world's largest accessible source of such fertilisers, the deposits of nitrogen-rich saltpetre and bird-droppings in Chile, would run out early in the 20th century.
The solution to the crisis was literally already in the air, in the form of the four million billion tonnes of nitrogen in the atmosphere. The problem was no-one knew how to extract the nitrogen and chemically "fix" it in a commercially viable form. This was the challenge Haber took on using the process he patented in 1908. The trick lay in forcing the nitrogen in the atmosphere to combine with hydrogen gas to create molecules of ammonia, which could then be turned into fertiliser. Nitrogen and hydrogen proved to be reluctant bedfellows, only combining in substantial amounts when crammed in reactors under pressures of 200 atmospheres and temperatures of 200 degrees C, together with exotic metal catalysts.
It took Haber and his colleagues five years of effort to bring the first atoms of atmospheric nitrogen down to earth - and even then it emerged from their giant reactor at the rate of just one drop per minute. Once the basic breakthrough had been made, however, things moved fast. Germany's largest chemicals company, the Badische Anilin und Soda-Fabrik (the forerunner of today's BASF) industrialised the process, and by September 1913 its chemical plant was churning out ammonia at the rate of several tonnes a day.
Haber had broken the spell of Malthus's prediction, and was duly lauded as a scientific hero. He was offered the directorship of a prestigious new chemistry institute in Berlin, and accepted only after having been granted a huge salary, membership of the Prussian Academy of Sciences, and a professorial chair. By the time he collected the almost inevitable Nobel Prize for chemistry in 1919, he had fallen under a spell of his own making. As well as being the basis for fertilisers, nitrogen is a key ingredient of extremely powerful explosives. A fervent patriot, at the outbreak of the First World War Haber offered his services to the German military. His nitrogen-fixing process was only part of his contribution to the war effort, however. Determined to impress his sceptical military paymasters, in 1915, he supervised the first-ever use of a chemical weapon - chlorine gas - near the Belgian town of Ypres, killing 5,000 Allied troops.
With Germany's defeat in 1918, Haber was deemed to be a war criminal, and fled to Switzerland. He returned to Germany when the charges were dropped - and immediately resumed work on chemical weapons. The full price of Haber's Faustian pact with patriotism finally emerged in 1933, with the rise of the Nazis. Despite his unstinting efforts on behalf of his beloved fatherland, the Nazi regime forced Haber into exile, having discovered his Jewish origins. Shortly after his arrival back in Switzerland in January 1934, he died of a heart attack, rejected and alone, at the age of just 65.
Haber's scientific legacy is no less rich in ironies. The current issue of Nature Geoscience carries a survey of the impact of the Haber process, which is described by lead author Dr Jan Willem Erisman from the Energy Research Centre of the Netherlands as "perhaps the most significant invention of the 20th century". Yet as Dr Erisman explains, the indiscriminate use of nitrogen fertiliser has led to a host of environmental problems, such as plagues of marine algal blooms, reduced biodiversity, threats to the quality of drinking water, and forms of air pollution that contribute to climate change.
A century after Haber patented the process that saved the world at the cost of his soul, it's time to tackle the small print of his Faustian pact. Robert Matthews is Visiting Reader in Science at Aston University, Birmingham, England