Upvote:3
The three poisons, greed, anger, and delusion, constitute the base-causes for beings stuck in samsara. Of these, delusion is the root cause from which greed and aversion arise. Avidya (delusion) is the root chain of the Twelve Nidanas , from which all other conditions for continued becoming arise.
Through the arising of these twelve nidanas, based on ignorance/misapprehension of reality as it is, the constituent parts of what we consider an "ego" arise ( consciousness/perceptions of the sense organs, feelings, sensations, etc.)
From this misapprehension of reality (ignorance) as either pleasant and something worth possessing, or unpleasant and unfit to endure, desire and anger arise.
I hope this helps clear this up!