Stage actors consider it one of those ultimate roles — the quotable, angst-ridden Prince of Denmark from Shakespeare’s “Hamlet.”

They also know you can’t phone that one in since doing it right means giving a demanding and exhilarating and grueling performance night after night. Andrew Scott has first-hand knowledge about that.

But what actor Ian Charleson accomplished with his hailed performances in 1989 were simply beyond comparison. The “Chariots of Fire” star earned praise on London’s prestigious National Theatre unbeknownst to most that he rehearsed and performed the demanding role while in the excruciating, crippling stages of AIDS.

It was something he just had to do.

“Right at the end of his life, Charleson kind of nailed his colors to the mast as an actor,” Scott said in October before receiving an award at the Mill Valley Film Festival for his transcendent portrayal of Charleson in the new film “Elsinore.” “And (it was) not just any part. The best part you could play.”

“Elsinore,” named after the city in which “Hamlet” is set, opens Nov. 25 in the Bay Area.It is Charleson’s intense commitment to perform the part that astonishes and inspires Scott, a versatile stage and screen actor best known for 2023’s “All of Us Strangers,” Netflix’s “Ripley” and, of course, his memorable “Hot Priest” turn on Amazon Prime’s “Fleabag” series.

Charleson, as film history tells it, leapt at the opportunity to play Hamlet for the second time in his career, replacing a disgruntled Daniel Day-Lewis, who fled the London production during a performance and never came back.

Taking on Hamlet can be that role of a lifetime for an actor, Scott admits.

“That doesn’t come around often,” Scott says. “(And) at the greatest theater in the world. He’s going to do it. He may not have been able to have any amount of time to celebrate it. But it’s wonderful that we’re able to celebrate him now.”

For Scott, portraying Charleson presented a unique opportunity and also a challenge. It helped that he could tap into his own heralded take on Hamlet in an onstage performance in 2017 England.

But the rub in director Simon Stone’s “Elsinore” is that Scott had to play an actor interpreting “Hamlet” from Charleson’s perspective.

“In one way it was helpful because in my body I can remember how exhausting it is,” he said. “I did it 150 times and you’re just a shell of a person afterwards because it’s three hours and 45 minutes. It requires all the arsenal of skills that you might have as an actor and all the lines and physicality — the sword fights. But the other side of it was that you had to unlearn whatever (your) interpretation of it might have been and imagine that Ian is sitting down and going ‘OK, what am I going to do with this part now that I know that the undiscovered country — i.e., death — is so near me?’”

To do so, Scott relearned all of Hamlet’s soliloquies, viewing them from the lens of Charleson.

In revisiting Shakespeare’s words, it brought up a new dramatic resonance. Scott saw parallels in what the Bard had originally written — the play was composed between 1599 and 1601 — then to an era in which “Elsinsore” is set, when legions of young and older gay men were wiped out by AIDS.

“The line that always gets me — it was written 400 years ago — is where Hamlet is talking about the war that’s going on and he’s saying: ‘I see the imminent death of 20,000 men that for a fantasy and a trick of fame, go to their graves like beds.’ Well that was what Ian was seeing during the AIDS crisis.”

The recent advances in HIV treatment create a different landscape for today’s younger people, Scott finds, and “Elisnore” can help a new generation understand what happened before.

“To imagine that at your absolute wonderfulness of being able to go to World Pride and (then) to imagine if you went away with 25 of your friends and that 17 of them might never come back. That’s an extraordinary difference in one generation.”

Attitudes were different then too.

Unlike his close friend — filmmaker and artist Derek Jarman, who later also died of AIDS — Charleson did not “come out” in public or even to his parents until after he was diagnosed with HIV. In the film, Jarman (played by David Dawson) insists that Charleson announce to the world that he is gay. Charleson refuses, but he does tell his parents while in the hospital and he later reveals his health status to the theater company. He later asked that his condition be publicly disclosed after his death, making him what historians say was the first British celebrity to officially die of AIDS.

To better inform who Charleson the person was, Scott and screenwriter Stephen Beresford sought to know more about him before his AIDS diagnosis.

“He was somebody who’s so light and so fun,” Scott said. “If there was one thing that came back about Ian, it was just how fun he was, how funny he was and how light he was. He just had a wicked sense of humor. That was very important to Stephen Beresford … to just make sure that everyone was having a bit of a laugh because sometimes that’s the most generous thing you can do in this situation is to go ‘somebody please make a joke.’”

One of the more uplifting elements of “Elsinore” is how Charleson found support, not fear or rejection, from family and the theater community.

Beresford, who wrote the 2014 film “Pride” that co-starred Scott, said “Elsinore” seeks to celebrate those who extended a helping hand to gay men stricken with AIDS through a terrible time.

Charleson’s support systems were strong.

At a recent screening, Beresford was asked why “Elsinore” doesn’t feature characters recoiling from or being afraid to be around Charleson.

“And the answer was because it didn’t happen (to him),” Beresford said. “The larger story of this crisis is of people showing up and in absolute physical and practical terms being face-to-face with people and supporting them and loving them.”

The film honors those individuals and also spotlights the groundbreaking care in the U.K. offered by Dr. Margaret Johnson (Olivia Colman) who treated Charleson at the Royal Free Hospital and was moved by his insistence to realize his ultimate dream. Scott calls Johnson a hero who publicly stood by her patients. The film also highlights the tireless work of the Sisters of Perpetual Indulgence amongst others. Beresford said he and Scott got invited to the New York-based nonprofit God’s Love We Deliver, which formed in 1985 during the height of AIDS and provided meals to those with AIDS. It has since expanded its mission to helping others with chronic diseases.

“The story of that is absolutely what we’re talking about,” Beresford said. “The story of people who just showed up with food and the human connection was alive.”

While honoring those people and organizations is vital — as well as celebrating the work done to counter fear and hate led by the late Princess Diana and pop star Madonna, among others — Scott says it is also imperative to call out the unforgivably slow response to the epidemic and the cultural fearmongering and homophobia during that harrowing time.

“If there’s any shame, the shame lies with the governments who just didn’t provide any information or help to those people who were dying,” Scott said. “Those nuns had to go places where gay people hung out and give them information because people were terrified and they didn’t know what to do. People were saying extraordinary things and they were burning bed linen. And you know boys were going home to their childhood homes and being hidden in spare rooms, away from the neighbors, as they died there. Just absolute prejudice beyond belief. It’s just important to remember that wasn’t so long ago.”

Just as an actor needs to throw himself fully into playing a role such as Hamlet, portraying Charleson required Scott to undergo personal transformations as well. “There was a big physical component about weight loss and the build-up to it,” he said. “But I was happy that the film was being made, so even though it was tough, I was so grateful to be there. I was so grateful that I would get to play this part. I was so grateful that all these unbelievable unicorns of actors came to be in it.”

Beresford says, in turn, that “any sane person” would have thought of Scott for the role. The actor is also one of “Elsinore’s” executive producers.

“They both shared something which is that they were very witty actors,” Beresford added. “Andrew really understands the jokes and understands how to land the jokes in the same way that Ian did. I think in order to play that part, which requires making yourself so vulnerable, you need somebody who has a hugely courageous approach to their work and Andrew just has that in spades.”