Life takes strange turns. Matt Haig’s new novel, How to Stop Time, is coming from Viking in February, and film rights have been bought by Benedict Cumberbatch’s production company. Haig has had the ambition to be a writer since he was young, but he lacked the self-confidence to tell his school career advisor. Instead, he said he’d like to work in publishing, and the advisor suggested librarianship.

As it turned out, Haig was seized by depression in his early 20s, and the agoraphobia that accompanied it radically reduced his options. Writing “kind of happened by accident,” he says, when he retreated to the family home in Nottinghamshire and holed up in his old bedroom.

“A nine-to-five job would have been difficult, and there was a limit to the amount of things I could do from home,” Haig recalls. “So I started doing journalism and writing about stuff I wasn’t interested in, like technology and marketing. It was an easy inroad. I’d have preferred to be writing book reviews, but I was trying to think from a business perspective in a period when writing became a kind of necessity for me in terms of therapy. I was having a panic attack every time I walked out of the house. The one thing I could do was write, and writing was like meditation. While I was writing, I wasn’t thinking about being ill. My depression was coupled with anxiety so I never had that urge to stay in bed. It was the opposite—I was restless continuously. That’s the reason I could write a lot of books in a short space of time.”

Writing nonfiction, Haig says, “taught me discipline—taught me about writing as a trade, a job.” Seeing his name on the covers gave him the confidence to feel he might be able to write a novel.

Haig’s fiction debut, The Last Family in England (published in the U.S. as The Labrador Pact), is nothing if not audacious: it’s a retelling of Henry IV, Part 1 from a canine perspective, as Prince, a Labrador, endeavors to keep his human family together. It was “a silly book, quite dark, because I was still a bit depressed,” and it found a publisher, the London house of Jonathan Cape, thanks to a few words from Jeanette Winterson, whom he’d interviewed for a newspaper article. “She gave it an endorsement, and as she was published by Cape, I got my foot in the door.”

The book sold around 50,000 copies and marked Haig as a literary author, even though he didn’t feel he necessarily fit into the category. A couple of more self-consciously literary novels followed. The Possession of Mr. Cave is the one he’s most proud of, despite feeling there’s “something inauthentic about it.” It was also his last “truly pessimistic” book.

After a clutch of bestselling and award-winning children’s books, plus a brave and well-received account of his battle with depression (Reasons to Stay Alive), Haig turned his attention once more to adult fiction. Perhaps it was the conscious revisiting of that dark period of his life that had reminded him of an idea that had first crossed his mind when he was ill: to write from the perspective of someone really old.

“During my three-year bout of depression and after, I felt like I was 439 years old,” Haig says. “Rather than writing a novel about depression, I thought it would be far more entertaining to write about it through fantasy. It was a lovely device for me to explore my own worries and anxieties—I’ve had lots of worries about losing people, which is the ultimate form of separation.”

Thus was born Tom Hazard, the protagonist of How to Stop Time, who, in his present life as a history teacher in East London, looks much like any 40-something male. “If you’re 439 years old, you’ve lost everyone and everything, and yet history is still there—Shakespeare, Victorian architecture, all those echoes of the past.”

Haig says he didn’t immediately “find the groove.” “I had the idea that Tom would be a refugee. Here’s this guy who looks like a perfectly normal white privileged guy, but he’s lived long enough that he would once have been in a minority group, a Protestant having to flee a Catholic country. I had to think how old he would be—would he have known Socrates and Plato? Would I go for some ridiculous, almost infinite, length of time? I decided to keep his life within the expanse of very long-lived living creatures, like those clams that live 500 years, where it’s scientifically plausible.”

There’s a rare genetic disorder called progeria, which causes people to age very quickly, so Haig invented its opposite, anageria, where the speed of aging is radically slowed. “That gave me my most realistic route into the story,” he says. “That’s when I knew I could write it—and then came the fun stuff.”

So Tom knew Shakespeare, played the lute in a number of his Globe Theatre productions. He voyaged with Captain Cook, sailed into New York harbor when Lady Liberty’s copper still glinted in the sunlight and when the Upper West Side was newly built. He heard Tchaikovsky perform at Carnegie Hall. Haig says: “Tchaikovsky was very old and Carnegie Hall was very new. Tom as a character has a sense of the world suddenly happening very quickly. It’s a key moment.”

Haig explains that he wanted to create “flesh and blood” from history, to take “the clichés and the dryness” and find something new. “It was about finding a thread through time. History, when we study it, is split into chapters. I wanted to take someone who’s not seeing it in those terms.”

For Tom, history is simply life, a continuum, and it was important that his present-day life be “ordinary” but “worth having.” As a history teacher, Tom “finds his purpose.” Haig, who comes from a family of teachers (and who homeschools his own children), admits “to trying, in a teacherly way, to spread a little passion for history.”

The research, Haig says, was fun: “a springboard to the imagination.” He’s visited many of the places to which Tom has traveled in the book—his success as a children’s author means he’s regularly on the road in Britain, visiting schools and leading workshops, and he’s been to the U.S. (“I enjoyed the challenge”) and is looking forward to addressing the ALA in February. But, he says, “I’m still very much the former agoraphobic who stays at home.” Much of the research was done from his desk.

As for the film, Anthony McCarten (who wrote the screenplay for The Theory of Everything) will write the screenplay for How to Stop Time, leaving Haig to his books. He’s just finished Notes on a Nervous Planet, another look at depression, and is working on a kids’ novel and another for adults. “I’m not entirely happy with it at the moment—it’s going to be either abandoned or radically altered,” he says cheerfully.

Liz Thomson is a London-based journalist and author and the cofounder of the Village Trip, a festival celebrating the history and culture of Greenwich Village.