Stepping into an iconic role is never an easy task, and the re-cast crew of the “Star Trek” franchise get to do it for a third time.

Karl Urban, a New Zealand actor famous for playing Eomer in the last two “Lord of Rings” movies, took over the role of belovedly grumpy Dr. Leonard “Bones” McCoy from DeForest Kelley, who originated the character in the original “Star Trek” television series.

“Star Trek Beyond,” in theaters July 22, marks Urban’s third turn in the role, and the actor says he believes that it’s “probably the most well-defined version of the character that I’ve had the pleasure of playing.”

Bones gets to show off his heroic side in the film, sharing some exciting scenes with Zachary Quinto’s Commander Spock, and even getting to pilot an alien spaceship.

amNewYork spoke with Urban about the film.

What role does Bones play in “Beyond”?

In this film, we get to see his true friendship with [Captain James T.] Kirk; you get to see him be a consigliere and adviser. ... And through the course of the movie, I spend an amazing amount of time with Zach Quinto’s Spock, and that’s a real opportunity to explore the relationship between those two characters, for both of those characters to come to an understanding on a deeper level what the other represents and where the other’s coming from. For Bones, there were just a lot of wonderful shades of the character that I was able to bring forward, whether it was his compassion and understanding emotionally for where Spock was at, or his bravery and courage in looking after Spock and not abandoning him, his fear of the situation they were in and his use of humor to keep the morale of the both of them up. And his willingness to live and survive — there’s a lot of wonderful shades.

What is your favorite aspect of Bones’ relationships with Kirk and Spock?

I think my favorite aspect of his relationship with Kirk is represented in the bar scene between the two of them, where you see two good friends sharing a drink and Kirk being able to sort of express his existential dilemma and Bones being able to listen and offer a sound piece of advice. And as far as Bones’ relationship with Spock, I enjoy any time that they get to argue, or the two of them get to have that great banter, it’s always a lot of fun. I particularly like the scene in the transporter where Bones discovers Spock has sold him down the river and requested that Bones accompany him on a dangerous mission. And Bones’ response to that is typically Bones.

Can you relate to Bones?

I can. The character of McCoy is somebody who has experienced his share of pain and loss through life. And I feel like there is somewhat of an irascible shell that he wears to protect himself, but the great thing about the character in this movie is you really get to see what’s beneath that. You get to see a softer side of the character. He lets his guard down in this film, and I think for me, probably, it was part of the process of making the character my own. It was important for me to still imbue the character with those familiar elements of DeForest, it was also an opportunity to take the character in a new direction.

Bones is such a fun character. I’d totally be up for a McCoy spin-off.

That’s the great thing about McCoy, he’s really a bit of a jack of all trades. You can throw him into any situation. He might grumble about it, but he’ll thrive. In this one, I get to fly an alien spaceship and do heroic things, and that’s kind of a part of the fun.

Director Justin Lin took over for J.J. Abrams. How was it working for him and how do you think he did?

It was an enjoyable experience. Justin came in and was very sensitive to respecting the core of this cast and he brought in a real passion for “Star Trek” — he was a fan of it growing up as a kid. He was able to take that knowledge and infuse it with this wonderful visual action style that he’s synonymous for and deliver an action-packed fun ride full of special effects and thrills and also some poignant emotional moments, and I think he’s done a fantastic job.

This film sets off on a new path rather than rehashing previous storylines. Are you excited by that direction?

Yeah, I think that the challenge was to not only honor the 50 years that had come before, but to also explore new territory, and “Star Trek” has always been a cult of personality. It’s about the characters, and I think Justin did a great job of infusing the story with an energy and a dynamism, and I think he was successfully able to build upon what J.J. established in ’09. ... It’s about this eclectic group of diverse characters who work together, and that’s the essential message of this film — we are stronger together than we are apart.

With fellow castmate Simon Pegg, who plays Scotty, co-writing the script, were you guys contacting him about your lines?

Simon emailed us an early draft and he said, “Look, if there’s anything you’d like to see in this that’s not in there, please let me know and we’ll work together.” That was really the basis of the working relationship for having one of our own who was there for us and accessible and a great conduit for us to really be able to express these characters on a deeper level. There are many beats, and in some cases scenes, that came from that that are in the film and it was a wonderful collaborative experience. It’s just a shame that Simon gets the credit for it. [Laughs]

“Star Trek” is so huge. How has this role changed your life?

Well I think the most profound change, and the thing that I value the most, is the friends that I’ve made. This cast is unlike anything I’ve worked with in the past, apart from “Lord of the Rings,” which was a very similar experience. But we’re a tight group, and there’s a real bond between us. We really are a family and we’ve now experienced coming up on 10 years of this phenomenon and there’s been highs and lows. Some of us have families now, some of us were married and are no longer married and of course we’ve recently lost, a devastating loss, of losing Anton [Yelchin]. We’ve been through a lot together.

I’m still heartbroken about his passing.

It’s absolutely devastating. There’s nothing that can prepare you for the loss of a family member and certainly we all continue to mourn him and grieve him and it hits you in the most unexpected ways and most unexpected times.

What are you working on next?

I’m about to go down to Australia for “Thor: Ragnarok” with Chris Hemsworth and directed by Taika Waititi, and I’m really looking forward to that. A lot of my stuff is with Cate Blanchett, and even though we were in “Lord of the Rings” together, I never shared any scenes with her and I have such a huge respect for her and her work and I’m really excited for that and I look forward to that.