Once upon a time, an Emperor was hunting when his red falcon caught a white gazelle. As he grasped the animal, it transformed into a beautiful princess in his arms and they fell in love. She was the daughter of Keikobad, the King of the spirit world, a woman of such translucent beauty that she cast no shadow, but she lived under a curse...

Richard Strauss's fairytale opera Die Frau ohne Schatten could never be accused of lack of scale or ambition: the evening runs at over four hours, the opera was scored for a 164 piece orchestra and was a conscious effort at a modern Zauberflöte without the silly bits. The Mariinsky Opera were up for the scale, packing the Edinburgh Festival Theatre with giant sets and cramming the orchestra pit with musicians.

With Valery Gergiev at the helm and Strauss's sumptuous orchestration to work with, those musicians made it a quite unforgettable evening. People come to opera for the "wow" moments, those times when the music lifts you out of your skin and into another world, and the Mariinsky Orchestra provided them by the dozen - luscious string textures, haunting woodwind quotes, powerful brass chorales, deep, threatening cello and bass ostinati - I lost count of the number of times the music made me catch my breath.

Vocally, the cast of singers were close to the same standard. Die Frau's female parts are varied and demanding: purity of tone and line for Elena Nebera's Empress, scalding sarcasm in intricate coloratura for Elena Vitman as her witch-like Nurse, and a combination of both for the most demanding role, Ekaterina Popova outstanding as the lowly wife of Barak the dyer. Nikolai Putilin gave us wonderful nobility and depth of feeling as the virtuous Barak; of the main singers, only Avgust Amonov as the Emperor was rather overpowered by the wall of sound coming from the pit.

The sets and costumes in Jonathan Kent and Peter Brown's production never failed to thrill, whether evoking the Emperor's lofty palace, the grimy world of the mortals or the terrors of Keikobad's underworld. The Emperor's palace and hunting lodge were set in Oriental legend with everything on a giant scale: a massive gold-studded red door, heavy silk brocade gowns and tall headdresses, the lamenting refrain of the red falcon's voice from a soprano on a man-sized golden falcon high above the stage. Liberal use of video projection onto gauze screens gave us a magical descent through the clouds into the unremittingly drab, industrial home of Barak the dyer, backed by washing machines, harsh strip lighting and a beaten up van. But when the Nurse summons up slaves from the spirit world, blue lighting and stars transform it in an instant into a place of magic as the slaves tumble out of those same washing machines. In the forest, the Empress's gown drapes in delicate arabesques from the tree on which she lies; in Keikobad's underworld, we see the roots of that tree and the wreck of Barak's van, washed away in the flood.

Musically, Die Frau is a masterpiece. Dramatically, sadly, it's a mess. The main problem is this: Hugo von Hoffmanstahl's libretto has some wonderful poetry, but much of the time, it's so overblown that it's very difficult to tell precisely what's happening on stage and why. It was hard enough even when I'd taken the trouble to read the synopsis thoroughly in advance: in the first act interval, I overheard conversations from people who were totally bewildered. Large tracts of the second act are repetitive; its climax doesn't quite engage and the third act drags dreadfully, leaving you to ignore any drama and enjoy the music.

But that music is a rare treat when played to this standard - it's equivalent to getting the excitement and power of a perfectly played Bruckner or Mahler symphony while being at the opera. Die Frau ohne Schatten may be a flawed opera, but I can't imagine it being done better; the Edinburgh Festival and the Mariinsky gave us a marvellous evening.