Out actor Neil Patrick Harris has said that there's “something sexy” about straight actors playing gay roles.

Harris is best known for playing Barney Stinson, a straight man who loves to chase women, on the long-running CBS sitcom How I Met Your Mother. He received four Emmy nominations for the role, which is considered the show's breakout character.

He plays a gay tailor in Channel 4's upcoming AIDS drama It's a Sin, which also stars Years & Years singer Olly Alexander and Stephen Fry.

(Related: Olly Alexander says he self-harmed because he “didn't want to be gay.”)

"I think there’s something sexy about casting a straight actor to play a gay role, if they’re willing to invest a lot into it,” Harris told The Times.

"There’s a nervousness that comes from the newness of it all. To declare that you’d never do that, you might miss opportunities."

"As an actor you certainly hope you can be a viable option for all kinds of different roles. I played a character [in HIMYM] for nine years who was nothing like me,” he said.

He added that as a director he would “definitely want to hire the best actor.”

It's a Sin will stream on HBO Max in the United States.