BRIGHTON, England >> As a young man suffocating under the weight of his depression, author Matt Haig almost walked off a cliff.

Now, 25 years later, Haig is an internationally bestselling novelist, and he has set his newest book in the very place where depression almost overcame him: Ibiza, Spain. The novel, called “The Life Impossible,” is about finding joy after heart-rending loss, which he tells from the perspective of a 72-year-old woman.

Over the course of his ferociously productive career, Haig has written fiction, nonfiction and children’s books, including books about aliens, Christmas stories and a novel about a man who lives for centuries. “The Midnight Library,” a novel about a magical library that allows a woman to enter alternate versions of her own life, has sold nearly 9 million copies since it was published in 2020.

Haig has also written a memoir about his struggle with mental health in “Reasons To Stay Alive,” and now, he has written about a place that very nearly undid him.

“‘The Life Impossible’ for me is so personal,” Haig said. “That was reclaiming my past a little bit — from a very different perspective.”

The book follows a retired English woman who has lost her husband and, many years before, her young son. Her small, closed-fist of a life could easily have petered out quietly in her living room. Instead, she goes to Ibiza on an adventure that we will not spoil here, except to say that it involves telepathy.

Haig, 49, lives in Brighton, in southern England, with his wife, two teenage children and two dogs, in a town house he describes as “a light box.” The ground floor is essentially one large open space with white walls, and the back of the house has been replaced by glass so light pours in from the backyard. It’s on a hill, in a row of houses all painted white, and from his living room, you can see a sliver of the sea dotted by wind turbines.

He and his wife, Andrea Semple, have been together since they were teenagers — they met the night Semple turned 19 — and she has watched him tear through novels, writing an astonishing 24 books in 30 years. Haig said he doesn’t believe there is such thing as a book that will be for everyone, so he writes with a reader in mind; sometimes it is a younger version of himself; often, it is his wife.

“He goes into hyper-focus mode on novels,” Semple said. “You go, ‘Matt! Matt!’ but he’s in his own world.”

When Haig writes, he often has several Word documents — several different novels — open on his computer at the same time. He toggles between them, working on maybe five or six projects simultaneously. For a long time, he wrote at least two books a year, sometimes more. But his pace at the moment is more relaxed, and four years have elapsed since “The Midnight Library,” his most recent book.

“That’s ridiculously slow for me,” he said. “The speed of ideas into my head — they’re not always good ideas — but the ideas you have to pursue, is quite fast. I always think, rather than the books I’ve written, about the books I haven’t written.”

At 46, he was diagnosed with attention deficit hyperactivity disorder and autism spectrum disorder, which helped him better understand himself, and the habits and structures he needs to thrive. Exercise is key to that, he said, but so is something like finding the right gym. When he joined a high-end gym filled with esoteric equipment, he said he had trouble staying focused and just bopped from one machine to the next. So he switched to an inexpensive gym where the only options available to him were some basic weights and a couple of treadmills.

Success for Haig did not always seem like a foregone conclusion. As a young man, he struggled to keep a job for even a month. Often at the three-week mark, he said, he’d get overwhelmed and quit, or just walk out without giving notice.

Writing has gone better. His first novel, which he published when he was 28, was a bestseller, and his fortunes have grown steadily since. His breakout book in the United States was “The Midnight Library,” a Good Morning America Book Club pick. In the United Kingdom, that moment came with “Reasons to Stay Alive,” a book that was part memoir and part self-help, told in short snippets.

“From that moment onward, it stopped being ‘a book by Matt Haig’ and started to be ‘a Matt Haig book,’” said his agent, Clare Conville. “His name became the reason you wanted to buy the book.”

Francis Bickmore, Haig’s editor at Canongate Books for 15 years, described Haig as a very unusual writer. For one thing, he’s fast. When he’s focused on a novel, Bickmore said, Haig will turn it around more quickly than any other author Bickmore has worked with. Haig is also extremely receptive to edits.

Bickmore described “The Life Impossible” as Haig’s love letter to Ibiza, the site of a profound crisis in his life, but a place he has made peace with. Now that it is no longer an island that haunts him, Haig can go there on holiday.

And as the book goes off into the world, Haig will be able to sit back and watch it go, feeling free.

“I think ‘Midnight Library’s’ relative success in terms of my career means that, in my own head, the pressure’s off a little bit,” he said, sitting in a restaurant in Brighton, the sea stretched out behind him. “I’ve proven something to myself and so I can just write what I want to write.”