St Matthew's Gospel 27, 26–31, has the flagellation and mocking of Christ occur after his condemnation by the people, before Pontius Pilate.
and when [Pilate] had scourged Jesus, he delivered him to be crucified.
Then the soldiers of the governor took Jesus into the common hall, and gathered unto him the whole band of soldiers.
And they stripped him, and put on him a scarlet robe.
And when they had plaited a crown of thorns, they put it upon his head, and a reed in his right hand; and they bowed and mocked him, saying, Hail, King of the Jews!
And they spit upon him, and took the reed and smote him on the head.
And after they had mocked him, they took the robe off from him, and put his own raiment on him, and led him away to crucify him.
The idea of mankind's general guilt for the sufferings of Christ is summed up in the verses printed beneath an image of the crowning with thorns by Albrecht Durer:
It is not enough to have flayed Christ with whips
And vilely persecuted him with all manner of insults
Behold him more dreadfully tormented.
He takes in his right hand a broken reed
With briars and brambles the divine head, true object of veneration,
Is choked and gouged. Stabbed. Battered.
Then he is hailed as the King of the Jews on bended knee,
With mocking laughter he is invested as the ruler of all things.
Spat upon. Kicked. Pummelled wuth blows. Torn
From his high throne and dragged by the hair.
Look, you wretched man, you cause of so much pain. The holy body is opened all over with wounds.
Christ, you have been made man so as to make us gods, and
You have been chained so as to release us from our chains. God
Tortured with floggings and thorns under an unjust judge,
You teach us to bear our sorrows with calm resignation.