[Religious ideas] are illusions, fulfillments of the oldest, strongest and most urgent wishes of mankind. The secret of their strength lies in the strength of those wishes.
Sigmund Freud, 1927
For Freud, the child's "terrifying impression of helplessness" gave rise to the desire for an all-powerful, protective, and just father. Freud thought religious ideas are built out of this desire and were fundamentally disconnected from reality.
Freud thought that illusions, like delusions, were derived from deeply-felt wishes.