Haydn was already in the employ of the Esterhazy court when he wrote his first sacred composition in 1767. The Stabat Mater is a medieval poem of unknown origin. It might have been written as early as the 13th century or at the start of the 14th. It was tossed out of the official repertoire of liturgical works in the Council of Trent in 1563, but has always stayed popular as a setting for musical compositions.
The most famous of Stabat Mater is probably Pergolesi’s. Haydn wrote his version thirty years after Pergolesi. The music refers to this work, already popular in Haydn’s time. It was first performed at the Esterhazy palace on the date of Good Friday.