Mozart wrote Die Zauberflöte (1791) to fulfill a commission from Emanuel Schikaneder, impresario of the Theater auf der Wieden in Vienna. Schikaneder provided the German libretto; they collaborated closely, evolving the piece from a simple fairy-tale Singspiel into a Masonic-allegorical masterpiece exploring:
Mozart, a Freemason, infused the score with symbolic numerology (3 chords, 3 priests, 3 trials). It premiered September 30, 1791—two months before his death—and was an immediate hit, securing his operatic legacy.