The denial of Peter was foretold by Jesus. He addresses Peter by his old name Simon:
“Simon, Simon, behold, Satan demanded to have you, that he might sift you like wheat, but I have prayed for you that your faith may not fail. And when you have turned again, strengthen your brothers". Luke 22 verses 31 and 32.
Just like with Job - Job 1 verse 6 to 12, Job 2 verse 1 to 7- Satan demands from God that he may test Peter in order to overthrow him.
Only when and insofar as God allows this, can Satan do this. Satan’s goal is to make the disciples lose faith and accuse them before God.
However, against Satan, who wants the destruction of the disciples, Jesus presents Himself as their Advocate: "But I have prayed for you, that your faith will not fail", etc.
Peter had made the confession earlier:
"You are the Christ of God". Luke 9 verse 20.
But now God allows Satan to test Peter. However, because of Christ’s intercession, Peter’s faith will not eventually disappear in the trial, but rather be purified.
Satan leads Peter to deny Jesus three times. Then Jesus turns and looks at him. Peter repents, and going out, weeps bitterly.
In the painting, Peter descends the stairs that lead to the house of Caiaphas, the high priest.
After His resurrection from the dead, Jesus has a conversation with Peter, on the shore of the Sea of Galilee, John 21, in which Peter rededicates himself to Jesus, and he is commissioned to be a ‘shepherd for Jesus’ sheep’ (followers).