In the course of organising my wife’s funeral four years ago, I faced an intriguing dilemma. Magteld had died at 38 years old, 21 months after she was diagnosed with breast cancer, and I was trying to put together a slideshow of her brief life. The problem was that our stock of photographs was dominated by the last few years, because people start taking a lot more pictures once they acquire a digital camera. This technological shift transformed the way we recorded our lives – instead of carefully crafting pictures that reflected the expense and effort of developing film, we could now simply shoot on the move and erase the failures. The only restriction was the camera’s memory.

It gave the images a spontaneity and an intimacy they often lacked before. And this was the core of the dilemma – how could I put together an honest account of Magteld’s life from such different elements? More importantly, would the form the memories took affect how people remembered her? One problem was that a sizeable chunk of our family archive spanned her time as a cancer patient, which was the phase of her life I was most keen to forget. How, in short, could I be true to the memory of the Magteld we knew and loved?

In the first picture I ever took of her she is standing on the campsite in Italy where we first met in June 1992, her feet set awkwardly apart, arms as straight as broomhandles reaching down to her thighs, a Mona Lisa-esque smile pulled across her face. Contrast this with another shot, taken around 15 years later, of Magteld lying on an unmade bed, with her feet against the frame and our younger son, three-year-old Adam, balanced on her legs. It’s a spontaneous picture full of joy and love and laughter, typical of her happiest moments. But it’s still just a snapshot, a fragment of the whole story.

Similar problems arose when I first sat down to write a memoir of her cancer treatment and the whole rollercoaster of emotions it unleashed. Magteld’s diagnosis came as we were preparing to leave Scotland for her native Netherlands; after her year-long course of chemotherapy, radiotherapy and mastectomy ended we were even more determined to emigrate, because if she fell ill again she wanted to be near her family. A week after selling our house in Glasgow she was told the cancer had returned – and that this time she would not recover.

We had booked a ferry across the North Sea for the end of April, which was then around 12 weeks away. I had a picture in my mind of the four of us standing on deck, waving and pointing at the approaching shore as our new homeland came into view. Her parents were due to visit us in March to help us pack boxes, never dreaming that they would instead be escorting an ambulance that took their daughter for an emergency operation at the Beatson Cancer Centre. A few days after that Magteld’s oncologist took me into a side room and told me to book her on the first plane to Holland, because her health could crumble at any moment. The glorious homecoming had been transformed into a frantic race against time.

At first I wanted the memoir to focus on that short, intense period between her initial diagnosis in August 2012 and her death in May 2014. The two interlocking journeys of death and emigration seemed to contain more than enough drama to sustain a book, but I realised as I wrote that the picture of Magteld that formed on the page was of a sick woman living in mortal dread and increasingly unbearable pain. I needed to fill in other details of her life to explain what we had lost: the girl I fell in love with, the woman I married and the mother she was to her two boys.

After her chemotherapy finished I embarked on what I called ‘the hair project’ – every few weeks I would take a photograph of Magteld with her head uncovered, so that years later she could look back and see how her hair had gradually returned. Hair loss is the most visible sign of cancer treatment, with all the associated pain and trauma, and its return symbolises the restoration of hope and vitality. This was still a time when we could believe in a future where the pictures chronicled her return to health and she would be able to flick through them in years to come with relief and gratitude.

What’s striking about the hair project pictures is not so much the growth on Magteld’s scalp as the expression on her face and the way it evolves from thinly concealed anxiety to a cautious self-confidence as she adjusts to her new self (her hair came back chestnut brown rather than blonde, with a thicker, firmer texture). It seems especially cruel, in this light, that the last of these photographs was taken less than 11 months before the end of her life.

The dilemma at the heart of the book was ensuring it went beyond simply saying: “my wife died of cancer and it was horrible”, even though the two main reasons for writing it were that my wife had died of cancer, and it was horrible. I didn’t want to shirk from describing the fear, the anguish, the despair and especially the rage that overwhelmed us at times. But it was also a time of hope. Every time fate knocked down our delicately built plans, we gathered up the splinters and built new ones. When it became clear she would be too sick to take the ferry to Holland at the end of April, we moved the date forward, booked her and her mother onto a plane and found a bed in a hospice. Weeks later, shortly after Magteld had moved into our house, the family celebrated our older son Euan’s birthday in the garden, eating cake and drinking Prosecco. Nobody had any idea, then, that she would be dead two days later.

People often ask, and I have often asked myself, how I could think of moving abroad with my family when my wife was terminally ill. Especially when they learn that our two children are both on the autism spectrum, with all the extra considerations that involves. In the first place, of course, it wasn’t a foreign country for Magteld. She could look forward to spending more time with her family, especially her sister, Sanneke, in The Hague, which was to be our new home town. In February, three weeks after she became terminally ill and only a month before the tumours in her spine would consign her to a wheelchair, she flew out to visit Sanneke and find a house where we could start our new lives and she could conclude hers. A home to die in.

I write in the book about how terminal illness catapults you into a kind of exalted present. It’s become a cliche to talk about ‘living in the moment’, but once your future ceases to exist the phrase acquires a very different meaning. Things have to be done now, because there really might not be a tomorrow; every time you wake up in the morning is a small act of defiance. Magteld invested her sense of aspiration entirely in her family’s future. I can still picture her in her room in the hospice, sitting in her wheelchair at a plain formica table with her head bent over a pile of papers dealing with schools, domestic care and hospital appointments. After an hour or so she would reluctantly succumb to exhaustion and take a nap. But that sense of purpose, of being involved in our lives until her last breath, invigorated her.

One of the last pictures I have of her is a selfie, close-up, taken sitting up in bed and captioned simply: ‘Me looking happy’. Within a week the mobility had returned to her arms and was breathing more freely; after a month she was able to discharge herself from the hospice and move into our house. And though she lived only two more weeks, they were richer and more rewarding days than if she had sat at home waiting for death to knock on the door – which, incidentally, is an option nobody ever chooses.

A friend remarked shortly after Magteld died that I had been lucky to experience that kind of love even once. Many widowers dislike this sentiment, but I found it consoling – though also troubling, since it implied that we only really appreciated what we meant to each other when death forced our hand. What was certainly true was that love made those final weeks bearable. Nights became rolling shifts, when I would wake after a few hours’ sleep, shuffle into the kitchen in pitch darkness, fetch Magteld’s pills or a pear ice-cream to soothe her aching throat (the cancer medicine had triggered a rash of mouth ulcers), and climb back in beside her. The reward was the warmth, the weight of her body, her smile and the sound of her voice; the horror came from knowing that this gruelling routine could be replaced at any moment by something far worse.

The end came brutally quickly. On the Friday, the day before Euan’s birthday party, she had started to complain about being out of breath for the first time since leaving Glasgow. On Sunday we recovered, took the children to a playground and watched a film. Early on Monday, after a sleepless half-night, an ambulance came to take her to hospital. By mid-afternoon she was gone. I spent the next few days in a state of disbelief, putting the children’s food on the table, reading them bedtime stories and wondering how on earth the mushrooms in the fridge, which we had bought on our last trip to the supermarket, had outlasted my wife. For weeks afterwards I fully expected her to walk in through the door one day with a bemused smile on her face and ask: ‘Where did you think I’d gone?’

Grief is always hard, but the loss of a partner has an extra dimension. It brings a package of unexpected and unsettling emotions. First there’s the relief, that the pain and anguish you have borne witness to are no more and you can finally get a proper night’s rest. That in turn triggers survivor’s guilt – how can you sleep at night when the person you loved most of all has been reduced to a pile of ashes? But most of all there is the abysmal loneliness. It begins with waking up in an empty bed, setting one less place at the table, setting out two mugs and teaspoons while making coffee and then having to put one back in the cupboard. It progresses to contacting banks, insurance companies, council offices, hospitals and care services as you laboriously extract your partner’s name from the official record. You watch friends and relatives gradually drift back to their regular lives, return to work, cooking meals together and sitting on the sofa in the evening with their partners. You, meanwhile, have to deal not just with the grief, but the violent disruption to your routine. Your former life no longer exists and somehow, in the scorched-earth landscape that cancer has left behind, you have to build a new one. Nobody ever talks about the loneliness, but it seeps into every corner of your life and numbs you, like the chill of a bright winter’s day.

At first I was simply too busy to grieve properly: the children needed to settle into schools, while I needed to find work and find my bearings as a widowed single parent and expat. Fundamental things had changed, such as the fact that the boys were Dutch citizens but had nobody at home to teach them the language. I learned, in passing, how little men perceive of the work women, and especially mothers, do to keep households and relationships running, because almost all my spare time was taken up with chores.

In this regard we were lucky to find a carer, Stephanie, who had experience of working with autistic children and had enough initiative to organise their routine more or less autonomously. After six months Euan and Adam started to call The Hague ‘home’ and speak Dutch in school, which was a considerable achievement in the context of their autism. However, discussing the loss of their mother proved to be an emotional stretch too far and after a few strained attempts, I gave up.

Writing the memoir, which I started around this time, was a way of making sense of a chaotic period of my life. Magteld’s decline was so rapid towards the end that I could only work out what order events happened in with the help of digital records such as Facebook and the blog she kept during her illness. I wanted to preserve the memories while they were still fresh, before Magteld was ascribed a saint-like status that she would never have wished for in life.

The low point came about two years in, at the end of the summer holidays. The boys went back to school and I finally had space to stop and reflect. I took a friend out for lunch, thinking it was time to revive my social life, but when I got home grief descended like a bomb. Until then I hadn’t been able to process Magteld’s absence from my life on any level deeper than the ticking of boxes on forms. I went to the beach, sat in the dunes and cried as I hadn’t done since the week she died. The experience taught me the importance of making time for grief: once it is rooted into your life it needs to be trimmed and cultivated, like a plant, or it starts turning up in unwanted places.

Over the next few months I cut back my schedule and narrowed my focus to finishing the book. I went for walks on the beach, ran and read books, being careful not to take up all my spare hours with housework and childcare. Gradually a sense of rhythm returned. The anxiety dissipated. It took three years altogether to absorb the sense of grief and accept it as a fixture in my life.

Not long before she died Magteld said she wanted me to be happy after she was gone, as if absolving me from the oncoming guilt and loneliness. That wish summed up Magteld’s special qualities: how tender, compassionate and selfless she was, right to the end. I can only hope that in writing, and in life, I’ve managed to do her justice.

All The Time We Thought We Had is published by Polygon, priced £9.99.