Philosophically, Thornton Wilder said that he was posing a question: "Is there a direction and meaning in lives beyond the individual's own will?" Describing the sources of his novel, Wilder explained that the plot was inspired
"in its external action by a one-act play [Le Carrosse du Saint-Sacrement] by [the French playwright] Prosper Mérimée, which takes place in Latin America and one of whose characters is a courtesan. However, the central idea of the work, the justification for a number of human lives that comes up as a result of the sudden collapse of a bridge, stems from friendly arguments with my father, a strict Calvinist. Strict Puritans imagine God all too easily as a petty schoolmaster who minutely weights guilt against merit, and they overlook God's 'Caritas' which is more all-encompassing and powerful. God's love has to transcend his just retribution. But in my novel I have left this question unanswered. As I said earlier, we can only pose the question correctly and clearly, and have faith one will ask the question in the right way."
When asked if his characters were historical or imagined, Wilder replied, "The Perichole and the Viceroy are real people, under the names they had in history [a street singer named Micaela Villegas and her lover Manuel de Amat y Junyent, who was Viceroy of Peru at the time]. Most of the events were invented by me, including the fall of the bridge." He based the Marquesa's habit of writing letters to her daughter on his knowledge of the great French letter-writer, Madame de Sévigné.
The bridge itself (in both Wilder's story and Mérimée's play) is based on the great Inca road suspension bridge across the Apurímac River, erected around 1350, still in use in 1864, and dilapidated but still hanging in 1890. When asked by the explorer Victor Wolfgang von Hagen whether he had ever seen a reproduction of E. G. Squier's woodcut illustration of the bridge as it was in 1864, Wilder replied: "It is best, von Hagen, that I make no comment or point of it."