Die Zauberflöte (or The Magic Flute) was written by Mozart as a commission by the impressario at a theater in Vienna in 1790-91 and was the last and (at the time anyway) most successful of his dramatic works.

It's set against a very masonic background. Both Mozart and his employer were active Masons, and the opera probably was an attempt to glorify the masonic movement, whose image has suffered a few blows at the time. Much of the actual story consists of a masonic initiation rite and some eyebrows have been risen over the amount of detail that is revealed. The masonic rites are usually kept pretty secret, but apparently Mozart had permission from higher up in his lodge to include this much detail. In any case Mozart was honoured by the Masons after his death in 1791 and the opera was a huge success for several years.