The Joan Miró exhibition at Tate Modern will draw attention, once again, to one of the 20th century's most famous art movements: surrealism. As a young artist from Catalonia coming to Paris, home of the surrealist movement, Miró absorbed its ideas and became one of its most brilliant artists. In its time, surrealism was seen as amoral, disgusting and extreme because it claimed to make art from the stuff of dreams. Today it is celebrated as a living influence. But was surrealism an original art movement at all?

I think that far from being a revolutionary vision hatched out of the brain of its leader, André Breton, the surrealist movement was actually the last echo of a quest for the irrational that has roots deep in the 19th century. The surrealists themselves hinted at this by frequently citing influences such as art nouveau. But when you examine the sheer scale, and radical scope, of the 19th-century obsession with dreams, illicit sex, secret confessions and the collapse of reason, you have to wonder if the surrealist movement actually said anything new at all.

The Gustave Moreau Museum in Paris is a good place to find the surreal before surrealism. Moreau (1826-1898) was painting unfettered fantasia of the irrational in the 1860s, more than six decades before the "surrealist revolution". His paintings and sketches in this museum return to such images as Salome dancing to secure the death of John the Baptist, Helen on the ruins of Troy, the loves of the gods and the dark side of myth. What transports them beyond illustration is Moreau's disturbingly suggestive style: he combines sharp, jewelled details with vague mists of colour in a way that raises his art from depiction to dream. It is like wandering into someone's drugged mind.

Moreau was seen by his contemporary J-K Huysmans, high priest of decadent literature, as a unique visionary, and he was exactly the kind of artist the surrealists named as a forebear. But while surrealism is constantly recycled by modern art museums, you have to go to Paris to find out much about Moreau. And he is not a unique case. By the late 19th century, fantasy was everywhere in avant-garde art. In Paris, you see the intensity of dream life in the colour-saturated later works of Degas, the jungles of Rousseau, the graphic art of Odilon Redon. Add into the mix Munch in Scandinavia, Klimt in Vienna, and Aubrey Beardsley in Britain and you have something far more substantial than a foretaste of surrealism. You have an earlier art of dreams, nightmares, sexuality and the macabre that illuminates the movement founded by Breton as just a coda, an epilogue.

The conventional history of modern art is a fiction. It is assumed to start in about 1900, when in reality modernism was alive and kicking in Paris by 1860 (at the latest) and by the 1890s was generating great, strange art all over Europe. Miró knew this, as did Dalí, because they grew up in the shadow of Antoni Gaudí's encrusted, organic, undulating turn-of-the-20th-century architecture, the greatest theatre of dreams that anyone has ever built. The visitor to Barcelona is impressed by Miró, but swept away by the architecture of Gaudí, that rises like one of Moreau's temples from the 19th-century epoch of dreams.

Art critic Adrian Searle considers Joan Miró's The Hope of a Condemned Man, inspired by the execution of the Catalan anarchist Salvador Puig Antich and included in a new exhibition of Miró's work at London's Tate Modern

Correction: Salvador Puig Antich was executed for the apparent killing of a policeman, not an admiral, as stated in the film