Jesus' trial before the council (Sanhedrin) was unjust, but necessary, for him to be put to death as a substitute for our sin. Peter's denial, an informal trial in the courtyard, increased Jesus' abandonment and suffering.
Watch: https://youtube.com/live/QU_3lBt7j38