According to Bellori (1672) this work was commissioned by the important di Franco (or de Franchis) family for a chapel in the church of San Domenico Maggiore. The family were connected with the Confraternity of the Pio Monte della Misericordia, for whose church Caravaggio had already painted The Seven Works of Mercy. It was moved to the museum at Capodimonte in 1972.
The Flagellation of Christ had long been a popular subject in religious art — and in contemporary religious practice, where the church encouraged self-flagellation as a means by which the faithful might enter into the suffering of Christ. Caravaggio would have had in mind the famous fresco by Sebastiano del Piombo in the church of San Pietro in Monitorio in Rome. Caravaggio has reworked Piombo's composition by drastically reducing the picture space so that the sculptural figures seem presented on a shallow stage. He has, however, retained Piombo's sense of the flagellation as a kind of sadistic ballet, with the figures arranged rhythmically across the canvas. Caravaggio's painting introduces an acutely observed reality into the scene—Christ is in this drooping pose, not because it might seem graceful, but because the torturer on the right is kicking the back of his knee while the figure on the left holds his hair tightly in his fist.
This series of highly dramatic and innovative Neapolitan altarpieces—the Seven Works of Mercy, this Flagellation, and a close companion piece, Christ at the Column, all done within a few months of his arrival in the city—instantly made Caravaggio the most talked-about artist in Naples, and the church of Sant'Anna dei Lombardi (Saint Anna of the Lombards—Caravaggio was originally from Lombardy) became a centre of the Caravaggisti, artists painting in the style of Caravaggio. These were not only native Neapolitans like Carlo Sellitto and Battistello Caracciolo, but included Flemish artists like Louis Finson and Abraham Vink who would later help spread Caravaggism to northern Europe.