A month after he had fled Nazi-occupied Vienna and settled safely in London, Sigmund Freud had an unwelcome encounter with Salvador Dali. Escorted by Freud's friend Stefan Zweig, Dali visited the frail psychoanalyst in his new home and harangued him on the subject of 'an ambitiously scientific article' that he - Dali - had written on paranoia. At first stonily indifferent, Freud muttered to Zweig: 'What a fanatic!' But then Freud made a characteristically double-edged observation: 'In classic paintings I look for the subconscious, in surrealist paintings for the conscious.' Probably correctly, Dali interpreted this dictum as 'a death-sentence on surrealism'.

However Freud may have meant it at the time, it is a comment that illustrates a neglected side of him. While he is rightly remembered for revealing the power of the unconscious in human life, Freud was always on the side of the conscious self. For him the ego was a fragile construction, permanently threatened by the forces of instinct and conscience - the id and superego of psychoanalytic theory. The fragility of the ego reflected that of civilisation itself, which rests on restraining powerful human impulses. The cost of civilisation in terms of human instinctual satisfaction may have been high - sometimes needlessly so, Freud believed. He never doubted that a measure of repression (and thereby of inner conflict) was the price of civilised life. In many ways an invigoratingly reactionary thinker, Freud rejected any idea of innate human goodness. Deeply suspicious of mass movements and somewhat sceptical of democracy, scornful of America (which he described as 'an enormous mistake') and cherishing few hopes of progress, Freud belonged to a European tradition that is nowadays practically extinct. An inveterate rationalist, he used reason to show that humankind will always be irrational. Civilisation is under continual siege, and the forces undermining it are not only instincts of aggression and destruction: they include the human longing for authority. Time and again humanity has turned to supposedly inspired leaders for salvation from psychic conflicts, only to find its hopes disappointed and its conflicts compounded.

In Freud's day the longing for authority boosted malignant political movements such as Nazism, but it was also embodied in Freud himself - a patriarchal figure who his followers believed could lead humanity out of darkness. The Death of Sigmund Freud is the story of how Freud dealt with this paradox during the last year of his life - and what a story it is! Writing with great skill, Mark Edmundson shows Freud in all his contradictory humanity. He was shrewd and sober in his dealings with the world; but he also indulged in acts of bravery that could easily have been disastrous. When required to sign a document stating he had been well treated by the Nazis on his departure from Vienna, he could not resist adding, 'I can most highly recommend the Gestapo to everyone.' Freud's courage went beyond defying tyranny. He also defied his own health. The cancer from which he suffered so cruelly in his final years was the result of his addiction to cigars, but he continued to smoke even when he was dying, after suffering over thirty operations, sometimes using a clothespeg to wedge open his jaw and insert another cigar. Again, no one could call Freud a sentimentalist. Yet he spent some of his last months translating, from French to German, a biography of a dog, a chow like Jo-Fi, his devoted animal companion during his final illness. As Edmundson comments, 'Freud's deep affection for dogs sometimes resembles that of his great predecessor, Schopenhauer, who said that he would rather converse with his dogs than with most people.' Perhaps understandably, the inventor of the talking cure sometimes wearied of human conversation.

Edmundson's mention of Schopenhauer is not incidental. Freud owed a great deal to the celebrated pessimist - including the crucial insight that much mental activity occurs beyond the reach of conscious awareness. Schopenhauer severed the link between thought and consciousness that had been so central in western thinking, and - followed by Nietzsche - helped create a new intellectual tradition. Freud developed this tradition boldly, and from it came the new discipline of psychoanalysis. At the same time Freud 'never identified himself with Schopenhauer and Nietzsche'. While the two philosophers did not pretend their insights could be empirically verified in any rigorous fashion, 'Freud thought that the only way he could genuinely succeed was as a scientist'. Maybe psychoanalysis would not have advanced so quickly had Freud not been so insistent in claiming for it the status of science, but in making this claim Freud also showed that in some ways he remained a typical fin de siècle Viennese intellectual. Like many others at the time his thinking had been deeply shaped by positivist philosophers such as Ernst Mach, who believed that only science could yield genuine knowledge. In effect, Freud claimed for psychoanalysis the supreme kind of modern authority - that of a scientifically grounded technique. As Edmundson argues, Freud would have been truer to the spirit of his writings if he had acknowledged that what they contained was not scientific knowledge but a sort of wisdom.

Freud spent his last years struggling to finish Moses and Monotheism, one of his most speculative and controversial books. It is also a book that is as timely today as it has ever been, for in it Freud subtly but decisively modified the hostile view of religion he had expressed in earlier writings. The rise of fundamentalism has generated a moral panic, which is expressed in a hysterical condemnation of religion in all its varieties. Freud never shared this hysteria, or believed that religion could disappear from human life. In The Future of an Illusion he had interpreted religion in conventional Enlightenment fashion: it was an illusion born of fear and ignorance. In Moses and Monotheism he presented a more complex view, which accepted that religion played an indispensable role in developing human capacities. Not inaccurately, Edmundson describes Freud as 'one of that breed of modern pagans who could not give up pondering rich mystery, even as they repudiated the all-knowing sky-god'. However, as Edmundson points out, it was not the pagan worship of mystery but rather the unseen god of Judaism that Freud celebrated in Moses and Monotheism. Without compromising his atheism, Freud argued that it was the Jewish belief in an invisible deity that enabled a new kind of self-examination to develop. From this soil a type of introspective inquiry grew up - quite different from the Socratic method, incidentally - that allowed individuals to explore the invisible workings of their own minds. Psychoanalysis - the systematic practice of self-inquiry - was not the end-result of an Enlightenment project of demystification, as he had once believed. On the contrary, it was a late by-product of religious faith.

The Death of Sigmund Freud is a wonderfully engaging account of Freud's last year. It is also a meditation on the human need for authority that makes a compelling claim for the importance of Freud as a political thinker. There are many studies of the social and economic conditions that enable fascist and fundamentalist movements to develop. The psychological needs these movements satisfy are less often investigated, and the fact that they appeal to deep-seated human impulses is denied and repressed. Freud accepted this fact and its implications not only for politics and religion but also for the new discipline he had invented. He wanted to confer on psychoanalysis the status of a science. Yet, unlike many of his disciples, he resisted the temptation to think of it as a technique that could bring about inner peace. Promising an end to psychological conflict is a way of consoling people rather than promoting the growth of consciousness. Freud's constant effort was to disappoint the hopes of consolation he had himself raised, and it is in this context that his achievement is to be measured.