The story of the opera is based on the medieval chivalric tale
Parthénopéus de Blois, which was written in the middle of the 12th century by
Denis Pyramus. In the original tale, however, the protagonist sorceress is called "Melior"; Esclarmonde's name was borrowed from another
chanson de geste of the 13th century:
Huon de Bordeaux. Although the Esclarmonde who appears in
Huon is completely different from her operatic counterpart,
Huon clearly served as the basis of at least part of the opera's libretto. Alfred Blau discovered
Parthénopéus in 1871 in the library of Blois, where he took refuge during the time of the
Paris Commune. The libretto was originally called
Pertinax; it was first drafted in prose and later versified by Blau's collaborator, Louis de Gramont. In that form – a romantic melodrama in five acts – it was offered in 1882 to the Belgian composer
François-Auguste Gevaert, who, however, declined to set it. Soon the libretto found its way into Massenet's hands, though the precise circumstances in which this occurred remain a mystery.