Here is a possible sequence of the events of Good Friday:
The trial of the early morning was most probably performed to ratify the decision that was already made during the night (Lu 22:66-23:1). This trial was "to make it legal".