The ego is simply a state of self-attack, taking place within a mind which has become divided against itself.
In this state, part of the mind has disassociated from the other part. There now appear to be two identities.
One identity is consciously identified with as "me" and the other as "not me".
The "not me" self, is very often equated with "the ego". It appears to be the self that we're always blaming and scapegoating, attacking and accusing, thinking of as other people etc.
But the trap there is not realizing who is doing the perceiving of an enemy. The person who sees enemies, AND the enemies themselves, are both two parts of ONE delusional thought system. They are both you.
The ego is not so much "that enemy" or the thing which is against you or your problems etc. It is the attacker and that which is attacked. It is both sides of every war. It is the state of *separation* taking place within yourself, between who you are and this illusion of who you are not.
Separating yourself from God was also an attempt to separate yourself from yourself. This could only create a condition in your mind where your original self remained, and a second self was added. You now think that only the second self is the "bad self", and label it the ego, but it is no more or less the ego than the self which describes it, because your real self was placed with a "persona" that pretends to be who you really are. It is the separation BETWEEN the two fake identities that is the ego.
So basically, if no-one else existed and there was just you and your mind, the entire separation from God would have to be taking place inside of yourself. And any conditions of conflict in which there seems to be wars or threats or enemies, those things MUST be also included inside your own mind. They're not outside of you.
So this is the key - the secret to salvation, that you are doing this to yourself. You have to realize that this so-called "not me", aka "my enemy", actually IS you. It's you who are against yourself, not other people. It's you who are at war with your own self. You do not have any enemies beyond yourself. That "not me" self is just part of your mind and will which you're kind of pretending not to have any control over, as if it's running on autopilot.
You have to therefore learn to recognize, that whatever it is which seems to loom over you with power and a separate will and a sense of threat or causality, making "you" at its effect, is actually your own self doing this to yourself. In other words, it's one disassociated part of your mind attacking the part which you're still associated with. You think it is not you and is attacking you - that's just part of you that thinks you are not you, attacking part of you that thinks it is you.
Truth is, you are not EITHER of these two fake identities. You are not the attacker or the attacked. You are not the victim or the victimizer. You are also not the self who looks upon the "bad enemy" and condemns them. That self is the other half of the ego, and the ego is always attacking itself. You are not the persona who rejects the shadow, and you are not the innocent victim who believes the perpetrator is not their self.
If you could see, that every pain and suffering, every attack, every torture, was actually being administered by a split-off part of your own mind, which you had disowned and disconnected from your sense of "conscious control", or your sense of the scope of your power or the reach of your influence, and if you can learn to recognize it and see yourself actually working "through" it to do things to yourself, then you will realize... you can stop doing that.
You can stop attacking yourself. You can stop hurting yourself. But even moreso, since the self being hurt is not you either, you can realize that you are no longer going to play EITHER role of victim or victimizer, and are going to give up the sense of identity that you were trying to protect from a fake enemy, transcend both of them, heal the *SEPARATION* that was creating them both, and return to a mind of wholeness and oneness.
if you could but see that you do everything to yourself, and get in touch with that choosing and doing, then you would simply realize how futile that is and stop it.
Sometimes you'll find in the day that a song is playing in your mind. It seems to be on autopilot. It can play for hours without you even noticing. And then maybe you notice and can't get it out of your head. But the thing is, it's actually being played by a part of your own mind, a part which is mostly unconscious, and you are just "allowing" it subtly to keep going. When you reclaim that power and recognize, it's YOU who is making this song keep playing in your mind, you reclaim the ability to stop it from playing. And it will stop. Because no-one else was playing that song. It was you.
It's the same thing with any aspect of the ego. You think it's outside of your control, beyond your choosing, disconnected from your influence, outside your power, and separated from "you". Reclaiming and owning that is the key to salvation. Taking back responsibility for everything you are experiencing.
No-one and nothing can happen to you against your will. No-one dies without their own consent. If you do not choose to attack yourself, you will be in capable of experiencing attack. No-one else has the power to go against your will. Your will is as powerful as the Son of God. There is nothing that can cause you other than God. You cannot be at the effect of anything but God (and that's a good thing). It guarantees that you are immortal and invulnerable forever, if you will just stop doing stuff to yourself unconsciously.