For years I thought I suffered from perpetual spiritual crisis. Call it a long-term dark night of the soul. Call it depression. Call it just feeling like garbage. It didn’t matter what name I gave this overall feeling of malaise, it just felt terrible.

Then one day I got some sleep and, well, it was like heaven opened up and sent down its angels to minister to me.

Like millions of other Americans, I suffered from bad sleep. Most of that I chalk up to being a bit of a night owl and then having to rise early for work every morning. I was too busy living life and I didn’t want to go to sleep.

That worked fine for me while I was in my 20s and 30s, but once I hit 40 things started to change. I struggled with feelings of hopelessness, a cloudy mind, slow reflexes, and a sluggish body.

I don’t think you would have known this just by looking at me, though. My wife and I still held hands. I played with my kids, laughed and told jokes. Professionally, it was mostly a successful time.

As an editor I worked with a number of high-profile authors, including two popes and thought leaders in the fields of religion, medicine, and spirituality. I also published a number of well-received books and appeared on TV and radio.

But inside I felt awful and it put a lot of stress on my relationship with God. I thought of myself as one of T. S. Eliot’s hollow men, “a headpiece filled with straw.” I was riddled with anxiety. And that made me feel guilty about how much I trusted Jesus.

If God is for us, who could be against us, St. Paul once wrote. Well, I understood that intellectually, but emotionally I didn’t experience that at all, which only made me feel like I wasn’t trusting God. Did that mean that everything I once believed and wrote about was a lie?

For years I averaged between four to five hours a sleep a night, in contrast to the seven to eight hours that doctors agree is necessary for mental and physical health. Sometimes I couldn’t fall asleep, but more often than not I would wake up in the middle of the night and my mind would race with worries great and small.

During those middle-of-the-night bouts of insomnia, I would silently cry out to God, begging him to just let me go back to sleep. But it didn’t work. I would just lie there in the quiet of a darkened bedroom listening to my wife’s breathing while freaking out on in the inside.

The more this happened, the angrier I got with the Almighty. “Why can’t you just let me sleep?” replaced my old prayer of “Jesus, I trust in thee.”

Then one day, in the midst of an expansive depression that I was certain was about to swallow me whole, I lay down in my bed and fell asleep around 10 p.m and slept straight through until 6 the next morning.

The strangest thing happened. All the angst and anxiety I had taken to bed with me the night before, all the worry and despair — well, they weren’t there when I woke up.

I was stunned when I realized that I felt refreshed. I had energy. I felt happy. I felt as if I had been raised from the dead. I felt beyond great; I felt like God was flowing through every pore of my body.

Some years ago, there was a Snickers candy bar TV commercial starring the actor and comedian Robin Williams. He played a ranting football coach who is losing his mind, chewing out his team for making bad plays. One of his assistants hands Williams a Snickers and says that he should eat it because, when he gets hungry, he gets a “little loopy.”

He takes a bite and is instantly transformed into a totally different person, a focused, winning coach who has it all together. Sleep was my Snickers.

Now, I’m not a doctor, and I’m not implying that sleep is a cure for clinical depression, although a connection between the two certainly can exist.

According to the National Sleep Foundation, a nonprofit organization that tries to promote the importance of getting those z’s, “The relationship between sleep and depressive illness is complex: depression may cause sleep problems, and sleep problems may cause or contribute to depressive disorders.”

What I do know is that once I started paying attention to my sleep patterns and how they affected my mood, I noticed a vast improvement in my quality of living, especially as I moved closer toward that doctor-recommended magic number of seven to eight hours of sleep per night. And not only that, but my relationship with God got better.

Could it be that all my doubt, mental angst, and feelings of spiritual isolation were a result of poor sleep hygiene?

Sleep deprivation studies have shown that proper sleep can prevent you from losing your mind — literally.

According to Dr. Rudy Tanzi, director of the Alzheimer’s Genome Project and a leading researcher in the field at Massachusetts General Hospital and Harvard Medical School, getting enough sleep helps clear away plaque that forms in our brain, which in turn impairs cognitive functioning.

Over time, plaque can build up and lead to all sorts of brain diseases. Dr. Tanzi knows what he’s talking about: He is one of the scientists who isolated the gene that causes Alzheimer’s disease.

Sleep is to the mind, then, what taking a shower is to the body. It rids us of toxins that we accumulate from day-to-day living. As I slept better, I began to wonder if a better night’s rest might be an important bridge to God for all of us who feel spiritually disconnected. I’m convinced now that it is.

Few studies have been done on the relationship between sleep and spirituality, however. But if we agree, as St. Ignatius would suggest, that there is a spiritual element to everything in our lives, then sleep itself is a spiritual experience.

If we deprive ourselves of sleep, we are in effect robbing our bodies and souls of the peaceful time that can become a time of communicating with God.

"St. Teresa of Ávila before the Cross," circa 1645, by Guido Cagnacci.

As I looked back over the years of poor sleep, I began to consider whether St. John of the Cross and St. Teresa of Ávila, both of whom wrote about dark nights of the soul and feelings of spiritual desolation, might have suffered from insomnia.

This is not to discredit their mystical experiences as just a byproduct of bad sleep. God works through our biology to teach us and guide us. Nonetheless, the question for me is one that merits consideration as it has helped reaffirm that God can be found in the dark at 3 a.m. as well as in the light or sunrise.

St. Augustine famously wrote that our hearts are restless until they find rest in God. Maybe he meant rest to include its literal sense in the here and now.

Stress still wakes me up in the middle of the night sometimes, but I’m making progress in handling these interruptions to my sleep, and I feel in my heart that my relationship with God is simultaneously improving as I do.