Many pieces which were said to have been composed by Pergolesi have been misattributed; the Stabat Mater is definitely by Pergolesi, as a manuscript in his handwriting has been preserved. The work was composed for a Neapolitan confraternity, the Confraternita dei Cavalieri di San Luigi di Palazzo, which had also commissioned a Stabat Mater from Alessandro Scarlatti. Pergolesi composed it during his final illness from tuberculosis in a Franciscan monastery in Pozzuoli, along with a Salve Regina setting, and, as it is said, finished it right before he died.