I grew up in post-war Britain when, saved from German invasion – men returned from war, children from evacuation, families were reunited – the comfort of the home became paramount. Its importance was marked out in sewn domestic niceties: embroidered tray cloths, cheval sets and tea cosies. My home had a sewing machine in the corner, an ever-ready sewing workbox by my mother’s chair and a box that brimmed with buttons for us children to rifle through by way of entertainment. This was my material world.

Living in industrial Glasgow, a city grimed with soot, smog and smoke, my landscape was monochrome until the day, when I was about six years old, my mother took me to an Aladdin’s cave in the city centre. There she bought me linen cloths already stamped with floral flourishes, packets of gold-tipped needles and silver scissors with handles shaped like a bird’s wings – and she let me choose loops of embroidery threads from a carousel of colours that dazzled me.

I had never seen so many hues of green, such a variance of red, blues that stretched from daybreak to midnight skies and all the shades in between. It was a revelation. On my way home, I held my trove of colours tight in my hand. Such a rainbow was treasure and it was mine. When there was little I could call my own, this bundle of sewing materials represented not just luxury but the thrill of sole ownership.

Even today, I cannot pass a display of embroidery threads without my heart missing a beat. Sometimes I even dream about textiles. I trail my hand through long-forgotten fabrics – crepe de chine, duchess satin, tulle net – grazing my knuckles on a crust of beading, smoothing down lengths of fringing and stroking the braille of lace. When I wake, it is always with the sharp pang of loss because the textiles I touch in my dreams have never existed, so there’s no hope of their rediscovery.

It was my mother who taught me how to sew. She guided me through the simplest of stitches – back stitch, blanket stitch, lazy daisy, French knots – and, through them, I discovered another way of writing, inscribing my cloth with motifs and patterns that seemed to speak of an elsewhere, a world more delicate than the rough and tumble of my own.

My dolls became dressed in sumptuous gowns encrusted with beads; the clothes I eventually learned to make for myself were graced with decorative stitchery. I liked the demands of embroidery, its requirement for concentration, its quietude. Its absorption offered me a retreat from the bluster of family life. Being the youngest of four children I had no place of my own. I shared a bedroom with my sisters and was squeezed among my three siblings in the back seat of the car. Grouped, as we were, by my parents into “you four” or “you children”, any sense of separateness was elusive.

Needlework gave me space. It cocooned me in my own privacy

But, through sewing, I could delineate a personal physical space. Needlework cocooned me in a privacy of sorts and while I have never lost my love of sewing as a private pleasure, in my chosen career path as a community artist, I made my sewing into a public art. Through sewing, I devised projects to involve socially marginalised people, encouraging them to create large-scale banners and wall hangings so they could tell the stories of their lives. I discovered a different kind of peacefulness in community sewing: the collective concentration and camaraderie of a common endeavour.

When I began to research my book, exploring the social, emotional and political significance of sewing, I discovered that during the Second World War, women who had crafted quilts and signature cloths in POW camps hadn’t made them in jolly spirit-reviving sewing bees. Instead, each woman sewed privately, reclaiming solitude and individual expression among the overcrowded and claustrophobic atmosphere of a camp where they were registered as a number. Through their embroidery they made time for themselves and through their sewn autographs they asserted their identity.

I read about Ruth First, the anti-apartheid campaigner who, faced with long-term imprisonment in solitary confinement, took up needlework to take control of her time. On the back of her lapel she stitched seven black lines to mark her days, but then would unpick one or two as if to gain time, or go forward at her own pace by sewing down the days that lay ahead. Hers was an act of both rebellion and self-preservation.

Today, in prisons throughout Britain, the organisation Fine Cell Work involves hundreds of men in embroidering items to sell online or make to commission. Paid for what they create, these men also stitch alone in their cells, finding respite from the clang and boom of prison life in the small oasis of peace afforded them by the rhythmic, repetitive act of sewing. Their needlework brings them sensory salve in the silken slip of thread and the soft crumble of cloth, a tactile antidote to the harsh and hard environment that surrounds them.

After the First World War, doctors experimented with getting shell-shocked soldiers to embroider as a way of healing mental scars and it proved a surprisingly effective way of steadying their hands and settling their minds. The Disabled Soldiers’ Embroidery Industry was established offering war-torn ex-servicemen, isolated in their homes or in makeshift hospitals, the opportunity to earn some much-needed income and rebuild their self-esteem. From the unlikely marriage of men of war and fine needlework, occupational therapy was born and has remained a mainstay of medical practice ever since.

It was an unlikely marriage of men of war and fine needlework

There have been many studies exploring the relationship between creativity and well-being: the benefits, particularly for those suffering from mental illness, of the mesmeric immersion in crafts as a relief from inner turmoil. I know for myself that it is what I turn to to cope with anxiety and, at times, grief. The banner I made for the chapel at Stirling Royal Infirmary, to commemorate the 16 children and their teacher who were shot dead in Dunblane in 1996, became a way for me to stitch down the sorrow I felt at the loss of my own children after two miscarriages. In the time and contemplation taken – embroidering an angel, her skirt strewn with poppies of remembrance, her arms wrapped protectively around a child – I found another way to mourn, a solace of sorts.

When my sister and I sat with our dying mother, for four days and nights I sewed. Although, by that time, she was in a coma, I like to believe she sensed our presence, heard me describing my work-in-progress and acknowledging the skill she had passed on to me. I still have the cloth I embroidered then. It evokes our last days together, connects me to her still and gives me comfort. This is the healing power of sewing: a way to express, sometimes exorcise, pain using a tactile language scripted by a needle and thread.

Sewing is increasingly becoming recognised as an effective way to combat depression, the absorption demanded by needlework – its flow – calming the mind and reducing stress. The sense of accomplishment can boost mental health and improve our immune system, as relief from the pressure of multitasking is replaced by focussing on one thing.

Today, through social media, people who are mentally frail can share their interest and skill in sewing without having to encounter the challenges of the wider world. The blog @sewcialists is a platform for those who have discovered a coping mechanism for mental illness or depression through sewing, helping them to connect by sharing stories. Sewing can also benefit dementia sufferers, translating their reminiscences into tactile quilts. Fashioned from vintage patterns and textures, they provide a sensory trigger to memory, as a prompt to conversation with carers and relatives.

In our social media age, as we become more physically distanced from each other, sewing is a safeguard to isolation, a way to stay in touch with each other: hand and mind working in harmony to convey what lies in our hearts. For me and others, it sustains not just a sense of self but of belonging.

Threads of Life: a History of the World Through the Eye of a Needle by Clare Hunter is published by Hodder & Stoughton at £20. Buy it for £17.60 at guardianbookshop.com