On the occasion of the coronation of Leopold II as Holy Roman Emperor, Mozart visited Frankfurt am Main in October 1790. More than a year before, he had completed a piano concerto that he had little opportunity to make known. Gone were the days when he composed six or seven concertos a year to present to an eagerly awaiting audience. His popularity had declined in a Vienna of swinging tastes. In the last five years of his life, he composed only two, the penultimate being the one he presented in Frankfurt on October 15, 1790, as part of the festivities that greeted Leopold's coronation. Thus Concerto No. 26 earned its nickname.
The concert is presumed to have been sketched out more than two years earlier, in the spring of 1787, after Mozart returned to Vienna having witnessed live the success of Le Nozze di Figaro in Prague. The new season had to be organized, with eyes set on the Lenten season. Opera, the music par excellence at that time, was forbidden in Vienna during Lent, so this was the time (which, as we know, lasted forty days) when his subscription concerts had to be presented in order to optimize the results.
In a letter to Michael Puchberg, his usual financial helper and fellow mason, Mozart assure him that he will soon pay off the last debt because he is working intensely on a new concerto (he also takes the opportunity to request a new loan). But he did not manage to finish the Concerto for Lent of that year. The concerto was completed in February of the following year, as can be seen in Mozart's private catalog, to which it was added on February 24, 1788.