The Battle for the Spiritual Light

In most Gnostic cosmologies, once the heavens are created and all
the beings emanated, the dialogue then switches to the battle between Sophia
(and the other Aeons) and Yaltabaoth for the spiritual Light that he stole.
The story describes how this negative entity - who was the evil god of
this world - proceeded to generate further entities, and created man,
in a kind of parody of the Genesis account of the creation of Adam.
There follows a long drama in which the Spiritual Powers work to free the
trapped Light from the grip of the lower powers, the creators and rulers
of this inferior world.

The existence of an evil God of this world, and the struggle between
a it and a good deity recalls the Persian Zoroastrian
and Manichaean belief in the universe as the theatre of conflict between Ormazd, the God of Light, and Ahriman, the God of Darkness. But the Gnostic, and also the Christian and Hermetic, doctrines in this regard go further, in that the world is entirely given over to the negative power [Dodds, Pagan
and Christian in an Age of Anxiety, p.16].

Various Gnostic sects disagreed as to the exact status of the demiurge.
The Valentinians were the mildest; they conceived of him as a being who
was not specifically evil but simply ignorant and unaware of any higher
possibility. The Simonians spoke of angels who had fallen away from
or turned against the transcendent Father. But for most, whether
the Christian Gnostic Marcion or the diverse Sethian sects, saw him as
the harsh unintelligent God of the Old Testament [Dodds, Ibid].

In the standard Gnostic myth, the Demiurge or Yaltabaoth - whether
out of ignorance or active malice - denies the transcendent spiritual Powers
of the Pleroma and claims to be the one Supreme God. This is clearly
a dig at the Old
Testament Deity who seems like a cosmic dictator when he
says "you shall have no other Gods before me". But when he does so
Sophia's voice comes from heaven a rebuke him: "Man exists and the Son
of Man" [Apocryphon of John], together with a vision of this celestial
being. "Man" here is not the Celestial Adam but the highest manifest
Godhead, the Anthropos, "Son of Man" is actually the Celestial Adam.
His son the heavenly Seth would be "the Son of the Son of Man". [Birger A. Pearson, "The Figure of Seth in Gnostic Literature", p.485 (in B. Layton, ed., The Rediscovery of Gnosticism, vol. 2. Leiden: E.J. Brill, 1981, 472-504)]

Startled by this Celestial apparition, Yaltabaoth decides the best
thing to do would be to make an image of it for himself. Exactly
why he decides to do this is never explained; the myth is poetic and very
irrational, more like a dream than a metaphysical conception or work of
theology. So he creates angels to rule over the world and aid in
the creation of man. Man comes to life when Yaltabaoth is tricked
into breathing his light-power into him; again, another parody on the Genesis
account; this time on God breathing life into Adam. Thus begins a
long struggle between the powers of Light (Sophia and the other Aeons)
and of Darkness (Yaltabaoth and his minions) for the possession of the
divine particles of light in man. The negative powers imprison
man in a material body, and also create woman and sexual desire to
spread and diffuse the particles of light through procreation, thus making
their salvation more difficult.

Finally, from the higher Spiritual regions a Savior, usually (depending
on the particular sect) Christ or Seth, is sent down to save humanity by
reminding them of their heavenly origin. Only those who possess the
saving Gnosis and have lived pure and ascetic lives can return to the realm
of Light; others have to reincarnate until they able to acquire Gnosis.