"Everybody knows what happened with me and Brit," Federline, 31, tells Access Hollywood. "I'm not going to say that's the total cause of it but, I mean, just not being happy with myself was probably the main part of my depression."
The former dancer blames the blues for his reluctance to hit the gym.
"Once you get depressed, you don't really feel like doing anything," he says. "You're kind of discouraged about yourself and then the weight gain too, or that makes me more depressed… I mean, it's a combination of all of those things."
Federline — who will chronicle his weight loss on VH1's Celebrity Fit Club: Boot Camp (premiering Feb. 14) — says he really started to slim down when his relationship with Spears improved. (They are parents to two boys, Sean Preston, 4, and Jayden James, 3.)
"I think as time goes on, it keeps getting better and better and better," he explains. "I mean, I'm really happy the way that my life is going right now, I really am.
"I think, you know, I have come a long way," he goes on. "All of us have…my whole family. It's gotten so much better from where we were."
With Spears' mental health much improved under the conservatorship of her father, Federline says, "I'm in the best possible scenario right now. I'm really happy for her."
Sign up now for the Us Weekly newsletter to get breaking celebrity news, hot pics and more delivered straight to your inbox!