Before I had children, one question occupied me a lot: what is the connection between mental health and motherhood? I knew the statistics. It is estimated that between 10 and 20% of mothers suffer from postnatal depression. Having a personal and a family history of depression increases your risk. I have both. I have been depressed. Not horribly, not debilitatingly, but enough to worry about it. So have others in my family. There was no way I would have put off having children because I was afraid that it might get worse. But I had a pretty good idea it would.

I first admitted to myself that I have depressive episodes in my mid-20s, when I began to see a therapist following the death of my grandfather. His loss had completely floored me. I had always tended to be negative and self-critical, but it seemed to be getting worse. I had a couple of anxiety attacks where I was unable to breathe – in a supermarket and on a commuter train. Therapy helped me to cope.

Feeling better, I stopped seeing the therapist when I became pregnant. At the back of my mind, though, I assumed I would be back before long.

We hear a lot about the negative effects of babies on women's mental health and very little about the opposite. Of course, not everyone gets the children that they desperately want. And of course, just being able to have them at all should make you feel grateful. But if you've known depression, you fear that becoming a parent won't make you happy. And you fear for what that situation might mean for your children.

It had never occurred to me that they would make me more – not less – sane. Before my first baby was born, I assumed it would be a struggle – and that I was at risk of becoming very low. When that didn't happen, and I felt an incredible surge of happiness, I was amazed. With every successive child – I now have Will, seven, Vera, four, and Jack, six months – any depression I do have seems weaker and easier to handle.

A lot of mothers feel this way – women who have known depression and mental illness before motherhood. The singer-songwriter Martha Wainwright, who had a brief experience of therapy, spoke recently about how she is different since the birth of her son two years ago. "Motherhood has changed my life for the better. I have spent a lot of my life thinking about myself, writing songs and staring at walls for hours, but now that's not an option – and that's a release in a way."

Kristin Hersh, 44, the New Orleans-based singer and guitarist in Throwing Muses, has published a memoir about how motherhood has rescued her from the worst of her mental illness. Paradoxical Undressing describes her diagnosis as bipolar shortly before an unplanned pregnancy at the age of 19. More than two decades later, with four sons aged between eight and 24, she says that her identity as a mother is the one constant that has never let her down. "I've had extreme ups and downs, but I've got very good at keeping them in perspective. That is a gift my children have given me. I know people who say, 'I couldn't get out of bed for a year.' And I feel for them.

"But I think, 'You didn't have to get out of bed.' If you have a child you cannot act that way."

She says that having children around helps her to keep herself in check, monitor her symptoms and nip them in the bud. "It keeps you from passing symptoms into personality, which is a huge weapon against the disease. Right now I prefer not to be on medication – because I feel poisoned when I take it. I see an acupuncturist and it seems to be the most powerful treatment for me. I'm not sure I would have sought that out if I didn't have to be clean and healthy for the children." Seeing things through her children's eyes keeps her sane. "I like the simplicity of it. They never allow me to stop seeing things as new and thrilling.

"They keep me from believing that I've seen it all." Basically, children help you to feel less jaded, a feeling which – in my case, at least – can quickly lead to feeling down and out of control.

But is there any truth in the idea that when a person becomes a parent, a new side of them is born and that is just as likely to be a less depressive side? The psychologist Daniel Stern explores this concept in The Birth of a Mother. "In the course of becoming a mother, a woman develops a mindset fundamentally different from the one she held before.

"This motherhood mindset pushes her pre-existing mental life aside and rushes forward to fill the centre stage of her inner life … As a woman adapts to motherhood, she not only takes into account who her baby is, but also who she has become because of having a baby and who she wants to be in the future."

This seems obvious. But it's still a pervasive idea that things are more likely to go badly for you – especially if you have a history of depression. As Ariel Gore writes in Bluebird: Women and the New Psychology of Happiness: "Conventional wisdom holds that women are twice as likely as men to suffer a major depressive episode in their lifetimes. Postpartum and maternal despair are so common that new motherhood is actually considered a major risk factor for depression."

It's possible that this attitude is finally disappearing and we don't have to accept the doom scenario. The psychologist Dr Dorothy Rowe, author of Depression: The Way Out of Your Prison, says there is no reason why a baby shouldn't make you happier – even with a depressive history: "Having a baby produces a mental change with every woman. It's not what happens to us that determines our behaviour, it's how we interpret that." She remembers experiencing a high herself: "I remember thinking a couple of hours after my son was born: 'I understand now why women have lots of children. Because it's so great.' Up until then I had thought it was mad to have lots of children. But I could see then that if you had a positive experience, why wouldn't you want to repeat it?"

We all too rarely read about family life as human Prozac. Often any kind of positive spin on parenting – especially motherhood – is seen as sentimental or smug. But the novelist Amanda Craig, mother of Leonora, 18, and William, 15, believes that becoming a mother can repel your worst thoughts.

"Before I had children I had been suicidal from time to time with depression and quite ill with it. But once you have children, that option is closed off. I felt that I had been given something joyful and positive to live for. I still feel that people aren't told that enough."

She says that as a parent you don't have time to be miserable: "It can be hard – the sleeplessness is the worst part – but you are too busy to get depressed. Excruciating though it is, I think a lot of depression is a kind of luxury. When you're frantic trying to fit everything in, you don't have five minutes to think about your own mood."

No woman should be afraid to have children because of how it might change her for the worse, says Craig: "I'm always very moved by the story of Virginia and Leonard Woolf, because she was prone to depression and he wouldn't let her have children – he thought it would disturb her mental balance. Knowing how she got on with her sister's children, I've always thought that this was precisely the wrong thing. Had she had children, it might well have not only helped her creativity and her mental health, but it would possibly have given her a feeling of contentedness. Of course some women do react badly to becoming mothers, but my view is that if you truly want children, the sense of connectedness they bring makes you more not less sane. My novels changed completely once I had mine. You share a kind of underworld with other parents, which, even when it's exasperating, is also liberating."

Chrysula Winegar, a US blogger and coach with four children under the age of 10, is working on a book called When You Wake Up a Mother. She is a whole-hearted exponent of the view that children can make you a better person in many unforeseen ways. She says her own children made her question the best use of her time, which helps her to stay focused and positive.

"What's it all for? What's the longer-term impact? What is the most important thing I could be doing right now, and what will have the greatest impact over time?" She thinks a sense of responsibility helps. "Small people are watching, so I try harder to honour the values I hold." Kristin Hersh echoes this. "You don't want your children to see you out of balance and so you begin to identify which behaviour indicates that."

I am not going to claim that having children has made me the happiest person alive (although very occasionally it feels like something close to that – you can be sick now). Nor do I pretend to sail through life untroubled by self-doubt, and a feeling some days that somehow I've messed up and I'm not quite sure how.

Having a family has not "cured" my depression. But I do know that since having children I am more in control of my moods. I did not expect that. It's a pleasant surprise. I wish I'd known.