As FBI agent Dana Scully in "The X-Files," Gillian Anderson investigated all kinds of strange occurrences and mysteries.

But in many ways, for much of her life, Anderson, 48, has been a mystery to herself. In therapy since she was 14 years old, she has suffered from a number of mental health issues, and she's opening up about that side of her life in a new book, co-written with friend and journalist Jennifer Nadel, "We: A Manifesto for Women Everywhere."

RELATED: Gillian Anderson shuts down Daily Mail's Botox speculation: I'm 'aging without shame'

"There were times when it was really bad," she recently told The Guardian. "There have been times in my life where I haven't wanted to leave the house."

The book isn't quite a self-help book, though it does contain a certain amount of self-affirmation, alongside Anderson's personal experiences. But when asked about some of the reasons behind all the therapy and the agoraphobia, Anderson declined to elaborate.

Trending stories,celebrity news and all the best of TODAY. This site is protected by recaptcha

She did note that there are "quite a few" sources to her problems, but noted, "I would have put them in the book if I wanted to talk about them out loud."

The Chicago-born Anderson has lived a transcontinental life, moving to London when she was 5, then back to the U.S. when she was 11. She spent her summers in London and went through a tumultuous adolescence filled with drugs, an addict friend and an older boyfriend. Her classmates voted her "most likely to get arrested" — and on graduation night she was arrested for breaking into her school to glue the locks shut.

Anderson with David Duchovny on "The X-Files." Ed Araquel/FOX

RELATED: Gillian Anderson: I was offered 'half' of what new 'X-Files' paid David Duchovny

Today, of course, she's a successful actress and mother of three who has developed strategies to help her deal with her mental health issues.

"I do a gratitude list every night," she told The Guardian. "I mean, it's in my head now, but I go through stages where I think I'm just complaining all the time again. It's too floating in my head, it needs to be on paper."

In addition to practicing gratitude every day, Anderson noted that mediation has helped her with body confidence.

RELATED: 6 subtle signs of depression you should never ignore

"All I know is that when I meditate, one goes beyond the physical, and it is possible to tap into a sense of absolute contentment and joy in that place," she said. "So if that's where you're starting then actually none of this," she said, gesturing towards her body, "means anything, really."

As much as the star may have struggled in the past, she seems to be in a better place today.

"But the acceptance of wherever we are, whoever we are, is freedom," the actress said. "So you know, I can sit and bemoan the fact that I don't get the same roles, or bemoan the fact that my skin is starting to look like chicken skin, or bemoan whatever it is. But that's not reality. That's fighting reality."

Anderson's new film, "Viceroy's House," will be out later this year.

Follow Randee Dawn on Twitter.