Mozart wrote the opera as his entry in a musical competition sponsored on February 7, 1786 by Holy Roman Emperor Joseph II at the Schönbrunn Palace in Vienna. The competition was to pit a German singspiel against an Italian opera. The competing Italian entry was the opera buffa Prima la musica, poi le parole (First the Music, then the Words), by Antonio Salieri.
It has been noted that the character and scale of the overture are similar to those of the overture to Le nozze di Figaro, which was written at the same time and premiered later the same year. There are only four vocal numbers in the score, and the musical content (about 30 minutes, including the overture) is surrounded by much spoken dialogue, topical in its day. In modern times, the text is usually completely rewritten.