When Irish actor Gabriel Byrne was first approached to play the role of Samuel Beckett, one of Ireland’s greatest literary heroes, he hesitated.

“I wrestled with the idea,” Byrne says on a recent video call from his home in Maine. “You know, screen biography is a very particular kind of genre, and for the most part people tend to imitate, walk, do wigs, all that kind of stuff.

“But this script wasn’t about an impersonation,” he says of Neil Forsyth’s screenplay for the new film “Dance First.” “It was about a kind of surreal examination of the kind of man that Beckett was. A very, very private man who suffered a great deal emotionally throughout his life. Very insecure in many ways.”

Beckett, who left Ireland as a young man to live and write in Paris for most of his life, seemed a mystery worth solving on screen, Byrne says.

“His private mask very, very few people got to see,” he says. “So he became this figure of fascination among people.

“So this was an attempt to get to grips with the private, emotional Beckett,” Byrne says. “And for that reason, I thought, yeah, this is better than doing a straightforward impersonation, though I understood that could alienate people as well.”

Director James Marsh, an Oscar winner for the documentary “Man on Wire,” felt a similar pull to the project once he realized it was not a typical Famous Person biopic. (“The Theory of Everything,” Marsh’s 2014 film about theoretical physicist Stephen Hawking, is a similarly creative biopic with an equally challenging protagonist.)

“I started reading it, and the first two or three pages were very conventional,” says Marsh on a video call from his home in Denmark. “You start with Beckett at the Nobel Prize ceremony where he’s getting the Nobel Prize for literature (in 1969).

“You think, OK, one of those. We’ll start with the great moment and — I could see it all unfolding,” he says. “But that scene very quickly becomes something very, very different.

“You end up not in a Nobel Prize ceremony but somewhere completely different after a kind of Buster Keaton sequence that takes you out of that environment and puts you in a very different place.

“Then, before you know it, this Beckett character you’ve seen at the Nobel Prizes, is talking with someone who looks exactly like him, who’s the Other Beckett,” Marsh says. “Who’s his alter ego, his inner voice made real, however you want to describe it.”

That, Marsh says, was the moment he decided he would not toss the screenplay on the reject pile, but read on and on until he was convinced he had to make the film.

“Dance First” is in theaters now. Its name is drawn from Beckett’s philosophy for life, “Dance first, think later,” a modification of a line in the play “Waiting For Godot,” his best-known and most frequently staged work.

The film is not so much an examination of Beckett’s writing process, or the plays, short stories and novels, as it is the story of the relationships that shaped, with chapters focused on his mother, Irish writer James Joyce and his daughter Lucia Joyce, his wife Suzanne, and his mistress Barbara.

“I knew a bit about Beckett’s life,” Marsh says. “I knew some of his plays. But the actual life story was surprising.

“I didn’t know much about his time in the Resistance (during World War II),” he says. “I didn’t know he’d been stabbed by a pimp for no particular reason. So these are the kind of things you think, ‘This is someone who writes the way he writes, a minimalist, very stripped down.’ Yet his life was so full of romantic adventure and surprising drama and violence.”

Once Marsh decided to make the movie there was only ever one actor he considered for Beckett.

“Early on, I said, ‘Well who can do this?’ And Gabriel popped into my head almost straight away,” Marsh says. “He was the only choice I ever had, and I kind of told myself if he says no I’m not going to do this. I thought he was the only person worth talking about it.”

Through a mutual friend, Marsh and Byrne met via Zoom during the pandemic, talking about the screenplay and their visions for making it.

“He’s got the same question I’ve got, ‘Should we even be doing this?’ ” Marsh says. “So we went in, we were holding hands, basically, to this project. For me, the reason for doing the film was that Gabriel wanted to do it, and we’re going to do this together.”

Byrne is not the only actor who plays Beckett in the film. There are several child actors for his youngest days, and Irish actor Fionn O’Shea plays him from his college days through World War II. But Byrne is present even in those earlier parts of the movie thanks to the creative decision to have him reflecting back on the regrets of his life in conversation with himself.

The majority of the film is shot in a gorgeously vintage black-and-white, with color used only for the final chapter of Beckett’s life. Marsh says it was a choice inspired in part by his 1999 debut feature documentary, “Wisconsin Death Trip,” and part by the budgetary restrictions of “Dance First.”

“It felt like going back to the beginning all over again, with a tiny budget, a black and white film,” he says. Which is a very different kind of aesthetic choice. You’re dealing with composition more. In black and white composition is vital.”

That decision also allowed him to include other influences including images inspired by early 20th century photographers in Paris such as Brassaï and Eugène Atget, Marsh adds.

For Byrne, the film underscored a feeling that Beckett’s life was not often a happy one, and that throughout it, as we see when the two Becketts look back over his life, he felt great regret and shame.

“Did he have much joy in his life? I suspect not,” he says. “I think he was tormented, for sure. He was a very insecure man with not a great deal of self- esteem.

“And what he valued most was his work,” Byrne says. “Because everything of him went into that work, but not in an obvious way. He redefined literature and theater through the way he expressed himself. But that feeling of shame for something that you never actually did? I don’t know how to explain that.”