The theology of Emanuel Swedenborg (1688-1772) is sometimes identified as panentheistic. Swedenborg rejected the idea that the universe is part of God. However, he saw God as pervading the universe and continually maintaining its existence from within and above. Thus God is present throughout the universe, from its tiniest to its largest parts. Here is a succinct statement of this principle, from True Christianity #33:
Every created thing is finite. The Infinite is in finite objects the way something is present in a vessel that receives it.
Swedenborg therefore saw God as present in everything in the created universe, both spiritual and material, as a continually creative inflow that maintains everything in existence each instant.
"Satan," in Swedenborg's theology, is not an individual being, such as an angel of light who fell away from God and became an evil angel and the ruler of hell. Rather, in Swedenborg's theology, Satan is a personification of evil, and in more practical terms, is the combined operation and presence of all of hell, which consists of all human beings who have chosen evil over good during their lifetimes on earth.
So in Swedenborg's theology, the problem of God's immanence vs. the existence of Satan is the same as the problem of God's immanence vs. the existence of evil. Put simply, if God pervades the universe, and God is good, how can evil exist anywhere in the universe?
Swedenborg's answer to this question incorporates the classical answer that human free will requires the possibility of the existence of evil. He states that although God does not create evil, God does create human beings with free will, which makes it possible for humans to bring evil into existence.
In a sense, evil is the rejection and absence of God. However, in Swedenborg's theology, it is not possible for anything to be entirely separated from God, because, according to the principle stated above, everything in the universe depends on God for its ongoing existence from moment to moment.
Swedenborg's solution to this is somewhat complex. A full exposition of it would require presentation of several principles he articulated, including "correspondences" (the precise way in which God is expressed in spirit, and spirit in nature), distinct and continuous levels of reality, and the interaction of human free will in relation to these.
However, here is a simplified version:
Evil exists only in the human spirit. No part of nature can truly be considered evil, though it may provide images that reflect human evil, such as the predator-prey relationship if projected into human relationships. But fundamentally, evil exists only in the human spirit.
This means that from the perspective of Swedenborg's theology, the problem of evil, or Satan, in relation to God's immanence is a problem of how God can be present in evil people, maintaining their existence from within, even while there is no evil in God's own nature.
This is possible, Swedenborg says, because even in the most evil of human beings and evil spirits, there is an uncorrupted and incorruptible part at the core of that human being's or evil spirit's self, or spirit. This part is above the consciousness of that human being or evil spirit, where it cannot be corrupted by that person's or spirit's evil desires. Swedenborg identifies this part as "the soul," in a restricted and technical sense. ("The soul" is also used more generally as a synonym for "the spirit.") God flows into this highest, incorruptible part of the evil human being or evil spirit, maintaining his or her existence from within.
In other words, God directly touches and flows into that inmost part of the evil being—a part that is not evil, but good. Therefore the infinite good that is God does not directly touch or interact with the evil in the evil person or evil spirit. If God were to touch the evil directly, it would be instantly destroyed.
However, as that inflow from God flows further down into the "spirit" or the conscious part of the evil human being or evil spirit, the evil character that that person or spirit has adopted twists that inflow from God, which in itself is good and true, into evil and falsity. This takes place in the finite, created, human part of the human being, and is therefore not a part of God's being, even though it is sustained from within by the life force of God's love and wisdom flowing into the inmost soul of that created being.
Swedenborg uses illustrations from nature to provide a picture of this flowing of God, who is pure love and wisdom, into human evil and falsity, maintaining their existence while not being evil and false itself:
God granted freedom not just to human beings but also to every type of animal; he even granted to inanimate things something analogous to freedom. Each entity receives that gift in accordance with its own nature. He also provides them all with what is good, but the entities themselves turn it into evil.
This can be illustrated by comparisons: The atmosphere gives every human being the ability to breathe, and does the same for every animal, whether domesticated or wild, and also for every bird, whether it is an owl or a dove; it also gives birds the ability to fly. Yet the atmosphere is not responsible for the fact that what it offers is taken up by creatures that are opposite to each other in nature and character.
The ocean offers itself to every type of fish as a place to live and also provides them all with food, yet the ocean is not responsible for the fact that one type of fish eats another, or that a crocodile turns the ocean's generosity into poison that it uses to kill people.
The sun supplies light and heat to all things, but its objects, which are the various types of vegetation on earth, use them in different ways. A good kind of tree or bush uses that heat and light one way; a thorn or a bramble uses them another way. A harmless plant does something very different with them than a poisonous plant does.
Rain from high up in the atmosphere falls everywhere on the ground. The ground then distributes that water to every bush, plant, and blade of grass, and each of them takes up as much of it as it needs. This is what I meant by something analogous to free choice, because these plants freely drink the water in through orifices, pores, and passageways that are open when it is warm. The earth does no more than offer moisture and nutrients; the plants take them in according to their thirst and hunger, so to speak.
It is similar with human beings. The Lord flows into every one of us with spiritual heat, which is essentially the goodness of love, and spiritual light, which is essentially the truth of wisdom. How open we are to these qualities depends on which way we are turned, either toward God or toward ourselves. Therefore in teaching us about loving our neighbor, the Lord says, "You are to be children of your Father, who makes the sun rise on the evil and on the good, and sends rain on the just and on the unjust" (Matthew 5:45). Elsewhere we read that "he wills the salvation of all" [1 Timothy 2:4; Ezekiel 18:23, 32]. (True Christianity #491)