Ed Sheeran has revealed his Game of Thrones cameo was meant to be a surprise for Maisie Williams, but the public's reaction to it "muddied" his joy.

During the seventh season of the HBO fantasy epic, the 30-year-old played a soldier sitting around a campfire who meets Williams's character, Arya Stark, on her journey back home.

In the scene, Sheeran's character sings a song called Hands of Gold, which he labelled "a new one," causing fans of the show to criticise showrunners for the Shape of You singer's inclusion in the series.

Speaking with Dax Shepard for his podcast Armchair Expert, the musician insisted his experience filming the cameo was "great," but fan backlash "sort of muddied my joy to it".

The hitmaker maintained his cameo was meant to be a send-off surprise for Williams, who was initially supposed to die during the second to last season.

According to Sheeran, Sophie Turner, who played Sansa Stark on the show, spoiled the moment when she accidentally revealed his cameo, but that Williams enjoyed the surprise nonetheless.

"She's always been awesome," he said of the actress. "I don't think they had written the ending yet. It was meant to be her last season but it wasn't. And as a surprise for her, (they got) me on. So, she was meant to turn up on set. and I was by the fire."