When it comes right down to it, the late Garry Shandling didn’t quite get into comedy for the laughs.

That conclusion comes from his close friend Judd Apatow, who plumbs Shandling’s long and sometimes tortured quest for enlightenment in The Zen Diaries of Garry Shandling, the two-part HBO documentary that’s contending for Emmy nominations in multiple categories.

“Usually you get into comedy because something is troubling you. You’re trying to work out certain issues,” Apatow tells Deadline. “What was interesting about Garry is he became a famous comedian because he thought it would help him figure out who he was. He didn’t do it because his primary interest was seeking fame and fortune. It really was about self-exploration.”

HBO

Apatow, who credits Shandling with a major impact on his career that included his first directing opportunity on The Larry Sanders Show, draws on home videos from Shandling’s childhood and journals he kept over a period of decades. Central to the performer’s makeup was the loss of his older brother Barry, who died of cystic fibrosis when Garry was just 10. His mother, anxious for her surviving son’s well-being, directed a smothering attention onto him.

With encouragement from George Carlin, Shandling would embark on a comedy career that eventually led to a regular slot guest-hosting The Tonight Show with Johnny Carson and creating two groundbreaking comedy series, It’s Garry Shandling’s Show and Larry Sanders.  But acclaim and the respect and affection of fellow comedians could not shake him free of angst that complicated his personal relationships. His bitter split from former manager Brad Grey left permanent scars.

Deadline spoke with Apatow about his documentary project and the man he calls a mentor.

Being such a close friend and admirer of Garry, it must have been cathartic and painful at times to make this film.

When Garry died, I thought to myself, he would want me to see the lesson in this. He certainly taught me a lot during his life, and that’s how I approached this project. What is the human lesson in Garry’s journey? I’ve had more feedback on this project than anything else I’ve ever done. I think it’s because, in addition to what’s fascinating about his career, I think people see themselves in him. They see their joys, their triumphs, their struggles, their attempts to be better people, and I think that would make Garry very happy.

HBO

How did he get interested in Zen Buddhism?

When Garry was a kid his brother was pen pals with a kid from Japan. After Garry’s brother passed away, Garry took over this pen pal relationship. That young man later came to America and was a foreign exchange student who lived at Garry’s house for a period of time. I think that’s when Garry first learned about Eastern religion and Buddhists. Throughout Garry’s life, in an era where very few people were interested in such things, Garry was reading about it and meditating. At some point he started journaling, in the late ’70s. That became the place where he explored his mind and these ideas. He kept those journals from 1977 until he died in 2016. So we have this really accurate information about how Garry felt about everything. I feel like most documentaries have a hard time going that deep because most people don’t leave behind such a specific record. I think that’s why the film is so powerful, because it goes as deep as you can go.

It was a tortured path to truth for him.

I think he knew how he wanted to feel and was frustrated it was so hard to get there. He was very educated about what a clear mind was and how someone like the Buddha felt. That’s always what he was seeking, but when you come from a complicated family and you’ve had certain traumas, it’s very hard to fully heal and not have those events affect you on a daily basis.

HBO

In the journals he kept he’s brutally honest with himself.

He did have an ego about wanting to be acknowledged or successful. I think that he had a lot of shame around it, and that’s what The Larry Sanders Show is about. It’s about ego out of control, and Garry understood that.

Do you feel like, in some respects, Shandling was a tragic figure? There’s certainly something tragic about his death, in the sense that it was so sudden and people felt so strongly about him. But he was also conflicted, and wounded by the battle with Brad Grey.

I think he had obstacles, but I can’t say that they were different than anybody else’s. We all have healthy times in our lives, and rough times. He definitely suffered as a result of broken relationships and difficult health conditions that zapped his energy and made it difficult to work. When I think about Garry, I usually think how almost every time I saw him, we laughed our asses off, and that he brought so much joy to so many people, just in the little moments of hanging out with him. And as much as he liked to talk and dissect things—he certainly was someone who might overthink something—I think he had a ton of fun. He got to see the world and meet the most fascinating people, and he did a lot of work which inspired others, and charity work, and had a lot of people who loved him until the end. So, to me, I think he lived a pretty fantastic life.

HBO

Are there things in particular that you especially treasure about your time with him, perhaps that come to your mind at random moments as you’re in your day?

One thing I noticed personally, when I went through all of the archives and all of my emails and communications with Garry, was that every time I asked him if he could help me with something, or show up to something, he said yes. Every single time. And he really gave me unconditional love and support. When it’s happening, it’s easy to not realize how powerful of an effect it’s having on you. He gave me my first great writing job, writing for the Grammys. He hired me to write for The Larry Sanders Show, he asked me to direct The Larry Sanders Show. That was the first time I ever directed. He gave me notes and advice on every project I ever made and was always there as a friend—a true friend—and that’s what I miss the most.

Oddly, at any moment, if I let my mind go quiet and I’m trying to figure out what to do, I can always access his voice. I feel like I can tell you exactly what he would say. In those situations, his point of view was always very clear, and I felt that while making the documentary. I certainly felt his guiding hand. Every once in a while I would think and then he would just say, “You know what to do. You know what to do.” I also thought he would say to me, “Tell them the truth. The only purpose of my life right now is to help other people with theirs. So if anybody can improve their life by looking at what mine was, I want to do that.” That’s what I hear Garry say.