In July 1791 Mozart was asked to write an "opera seria". He had been asked by Domenico Guardasoni who lived in Prague and who had the job of finding someone to compose an opera for the celebrations of the coronation of Leopold II, Holy Roman Emperor as King of Bohemia. The ceremony would take place on September 6, so Mozart had to work quickly.