The Light of the world was withdrawing.
John 12:
26 If any man serve me, let him follow me; and where I am, there shall also my servant be: if any man serve me, him will my Father honour.
27 Now is my soul troubled; and what shall I say? Father, save me from this hour: but for this cause came I unto this hour.
28 Father, glorify thy name. Then came there a voice from heaven, saying, I have both glorified it, and will glorify it again.
29 The people therefore, that stood by, and heard it, said that it thundered: others said, An angel spake to him.
30 Jesus answered and said, This voice came not because of me, but for your sakes.
31 Now is the judgment of this world: now shall the prince of this world be cast out.
32 And I, if I be lifted up from the earth, will draw all men unto me.
33 This he said, signifying what death he should die.
34 The people answered him, We have heard out of the law that Christ abideth for ever: and how sayest thou, The Son of man must be lifted up? who is this Son of man?
35 Then Jesus said unto them, Yet a little while is the light with you. Walk while ye have the light, lest darkness come upon you: for he that walketh in darkness knoweth not whither he goeth.
36 While ye have light, believe in the light, that ye may be the children of light. These things spake Jesus, and departed, and did hide himself from them.
The prince of this world was not cast out (vs 31) until after Jesus was lifted up from the earth (vs 32).
In vs 35, Jesus (Who is the Light) told the people the Light would only be with them for a little while.
The darkness which fell over the earth from the 6th to the 9th hour had its origin in the spiritual realm. A spiritual battle was raging and satan believed he had the victory. However, the resurrection proved satan to have been fully defeated. The ascension of the Lord Jesus Christ into heaven was even worse for satan. Jesus was set Far above all principality, and power, and might, and dominion, and every name that is named, not only in this world, but also in that which is to come (Eph 1:21). Now the Lord Jesus Christ is head over all things to the church, which is His body, the fullness of Him that filleth all in all (Eph 1:23).
If satan and his minions had known what God had in mind, they never would have crucified Christ:
1 Corinthians 2:6-8 Howbeit we speak wisdom among them that are perfect: yet not the wisdom of this world, nor of the princes of this world, that come to nought: But we speak the wisdom of God in a mystery, even the hidden wisdom, which God ordained before the world unto our glory: Which none of the princes of this world knew: for had they known it, they would not have crucified the Lord of glory).