During a performance of Broadway show Hedwig and the Angry Inch, Neil Patrick Harris created a storm of applause – and perhaps some embarrassment – by swearing at a fan who interrupted the actor onstage.

Harris was reportedly cut off by a female admirer who called out: "I love you, Neil!"

Harris, in the role of Hedwig, an East German transgender punk, yelled back: "I'm doing something up here, motherf**cker!"

The actor insisted later through Twitter that his expletives were the thoughts of his character, not himself.

"It seems my Hedwig improvs are making news," Harris posted. "But one should have the full story/context." He then provided a link to a Gossip Cop article on the matter, which clarified Harris' further improvisations at the time.

"Who's Neil? I'm not Neil. Are you Neil? You better not be Neil!" the actor warned his costar Lena Hall, who was also present onstage.

The lines were met with cheers from the audience.

Aside from further performances of the John Cameron Mitchell play, Harris will next be seen in the film adaptation of Gone Girl, set to be released later this year.