Julie Andrews revealed it was therapy that saved “The Sound of Music” star’s life after her first marriage came to an end in 1967.

“Sadly, I separated from my lovely first husband,” the 84-year-old told Stephen Colbert on “The Late Show with Stephen Colbert,” as reported by People magazine on Wednesday.

“And separations were always inevitable and the marriage was over and my head was so full of clutter and garbage,” the “Mary Poppins” actress continued. “Believe it or not, it was [filmmaker] Mike Nichols who really tipped me into wanting to go to therapy.”

Andrews said that it was Nichols’ healthy mindset that encouraged her to get help.

'SOUND OF MUSIC' ACTRESS ANGELA CARTWRIGHT REVEALS WHAT IT WAS REALLY LIKE WORKING WITH JULIE ANDREWS, CHRISTOPHER PLUMMER

British costume designer Tony Walton kisses the cheek of his new bride, British actor and singer Julie Andrews. Their marriage lasted from 1959 until 1967. ((Photo by Michael Hardy/Express/Getty Images)

JULIE ANDREWS SAYS SHE AVOIDED SEXUAL HARASSMENT IN HOLLYWOOD BECAUSE MEN FEARED HER HUSBAND BLAKE EDWARDS

“He had been, and he was so sane and funny and clear,” recalled Andrews. “He had a clarity that I admired so much. I wanted that for myself. And I didn’t feel I had it, so I went and got into it and it saved my life, in a way.”

Andrews said she was eager to share her experience getting therapy in her new memoir, “Home Work,” because she felt it would encourage others to do the same.

“The truth is, Stephen, why not?” said Andrews. “If it helps anybody else have the same idea.”

Andrews added therapy no longer has the same negative stigma it once had, especially in Hollywood.

JULIE ANDREWS TALKS 'SECOND CAREER' AND MEMOIR: 'THAT'S A WHOLE NEW LIFE FOR ME'

“These days, there’s no harm in sharing it,” she said. “I think everybody knows the great work it can do. And anybody that is lucky enough to have it, afford it and take advantage of it, I think it would be wonderful.”

Julie Andrews and Blake Edwards. (Photo by Ron Galella, Ltd./Ron Galella Collection via Getty Images)

JULIE ANDREWS RECALLS FILMING HER FIRST LOVE SCENE: 'MY LEGS BUCKLED'

Andrews went on to find love again with filmmaker Blake Edwards. That union lasted from 1969 until his death in 2010 at age 88.

Andrews previously told Radio Times magazine she was never sexually harassed in Hollywood because men were scared of her husband.

“I understand #MeToo very well,” said the British star. “It’s an important development and it should be recognized. A lot of things that were done in the old days were not done consciously, but they have to be changed today.”

“I was very fortunate I didn’t have any harassment in the business because, happily, I was married to Blake, who was highly respected and I don’t think people thought to bother with me,” Andrews continued. "I started working with him fairly early on, so I didn’t have any of that to deal with. That said, I’m all for equal pay and respect for women, all the things the #MeToo movement stands for, and I think it will eventually shake into newer respect for all the right things. It’s happening.”

JULIE ANDREWS' GRANDDAUGHTER SAID STAR 'WAS VERY STRICT' BUT FIERCELY GUARDED HER FAMILY

Blake Edwards with his wife Julie Andrews, after receiving the Legion of Honor, on May 9, 1992, during the International Cannes Film Festival. (MICHEL GANGNE/AFP/Getty Images)

JULIE ANDREWS TO RECEIVE AFI LIFETIME ACHIEVEMENT AWARD

Andrews’ film career began with “Mary Poppins” in 1964, after being passed over by film executive Jack Warner for Audrey Hepburn in the screen adaptation of “My Fair Lady,” Variety reported.

Andrews went on to earn an Academy Award for her portrayal of the magical nanny. She was nominated again the following year, in 1966, for “The Sound of Music” as Maria von Trapp.

Her late husband Blake Edwards is the filmmaker behind Hepburn’s 1961 hit “Breakfast at Tiffany’s.” Together, Andrews and Edward raised five children.

“Blake was the most charismatic and interesting fellow you could possibly meet,” Andrews revealed at New York City’s 92nd Street Y, as reported by Variety. “He was hilariously funny and had such a dark sense of humor that just put me away that I loved so much.”

WHAT DOES JULIE ANDREWS THINK OF EMILY BLUNT PLAYING MARY POPPINS?

Julie Andrews attends the Build Series to discuss "Home Work: A Memoir of My Hollywood Years" at Build Studio on Oct. 16, 2019, in New York City. (Jim Spellman/Getty Images)

‘MARY POPPINS RETURNS’ CAST DEFENDS FILM’S SO-CALLED 'FORGETTABLE' SONGS

“But he was also, at times, a very depressive personality and had a very difficult time,” Andrews admitted. “I knew him very well, and he knew me very well — we were married for 41 years before he passed — but he did have horrible bouts of depression, and he wrote more and more biographically the longer our lives went on.”

Andrews still kept busy pursuing her passion for acting after Edwards’ passing. Andrews said she hopes fans will remember her for bringing “a certain joy or delight in music and all things.”

“I’m so lucky, really, to have been that lady who was able to do all those wonderful things,” she explained. “My mother used to say, ‘Don’t you dare pull rank. There are so many people who can do what you do just as well. Be grateful, get on with it.’ And she was right. And so, I hope that what I do gives joy and makes people curious, which is I think one of the best qualities you can have in life, to be curious about things. And maybe that kind of thing would be nice to have as a legacy.”