Game of Thrones producers cast Ed Sheeran in the new series of the show as a “surprise” for regular Maisie Williams.

Showrunner David Benioff hired the British pop star to appear in the first episode of Season 7 as they knew she was a huge fan of the Galway Girl singer.

“We knew that Maisie was a big fan of Ed Sheeran and for years we've been trying to get him on the show so we can surprise Maisie,” said Benioff. “This year we finally did it.”

Sheeran’s cameo as a soldier in Sunday night’s episode left a number of viewers “confused” as he’s not known for his acting skills.

“It took me a minute to take #gameofthones seriously again after having to watch Ed Sheeran sing around a fire pit with some soldiers,” one viewer wrote on Twitter.

“Seeing Ed Sheeran in #gameofthones was the biggest wtf moment of my existence,” wrote another.

Game of Thrones: Season 7 - In pictures 21 show all Game of Thrones: Season 7 - In pictures 1/21 Kit Harington as Jon Snow HBO 2/21 Nathalie Emmenuel as Missandei, Peter Dinklage as Tyrion Lannister, Conleth Hill as Lord Varys, Emilia Clarke as Daenerys Targaryen and Jacob Anderson as Grey Worm Home Box Office 3/21 Maisie Williams as Arya Stark HBO 4/21 The Knight King HBO 5/21 Sophie Turner as Sansa Stark 6/21 Nathalie Emmanuel as Missandei HBO 7/21 Emilia Clarke as Daenerys Targaryen HBO 8/21 Gwendoline Christie as Brienne of Tarth, Kristofer Hivju as Tormund Giantsbane HBO 9/21 Kit Harington as Jon Snow HBO 10/21 The Knight King HBO 11/21 Lena Headey as Cersei Lannister and Nikolaj Coster-Waldau as Jaime Lannister HBO 12/21 Sophie Turner as Sansa Stark and Aidan Gillen as Petyr Baelish HBO 13/21 Rory McCann as Sandor Clegane HBO 14/21 Conleth Hill as Lord Varys HBO 15/21 Isaac Hempstead Wright as Bran Stark, Ellie Kendrick as Meera Reed HBO 16/21 Emilia Clarke as Daenerys Targaryen Home Box Office 17/21 HBO 18/21 Maisie Williams as Arya Stark HBO 19/21 Bella Ramsey as Lyanna Mormont 20/21 The Knight King HBO 21/21 Lena Headey as Cersei Lannister and Nikolaj Coster-Waldau as Jaime Lannister HBO 1/21 Kit Harington as Jon Snow HBO 2/21 Nathalie Emmenuel as Missandei, Peter Dinklage as Tyrion Lannister, Conleth Hill as Lord Varys, Emilia Clarke as Daenerys Targaryen and Jacob Anderson as Grey Worm Home Box Office 3/21 Maisie Williams as Arya Stark HBO 4/21 The Knight King HBO 5/21 Sophie Turner as Sansa Stark 6/21 Nathalie Emmanuel as Missandei HBO 7/21 Emilia Clarke as Daenerys Targaryen HBO 8/21 Gwendoline Christie as Brienne of Tarth, Kristofer Hivju as Tormund Giantsbane HBO 9/21 Kit Harington as Jon Snow HBO 10/21 The Knight King HBO 11/21 Lena Headey as Cersei Lannister and Nikolaj Coster-Waldau as Jaime Lannister HBO 12/21 Sophie Turner as Sansa Stark and Aidan Gillen as Petyr Baelish HBO 13/21 Rory McCann as Sandor Clegane HBO 14/21 Conleth Hill as Lord Varys HBO 15/21 Isaac Hempstead Wright as Bran Stark, Ellie Kendrick as Meera Reed HBO 16/21 Emilia Clarke as Daenerys Targaryen Home Box Office 17/21 HBO 18/21 Maisie Williams as Arya Stark HBO 19/21 Bella Ramsey as Lyanna Mormont 20/21 The Knight King HBO 21/21 Lena Headey as Cersei Lannister and Nikolaj Coster-Waldau as Jaime Lannister HBO

It’s not the first time a musician had made cameo in Game of Thrones (members of Coldplay and Sigur Ros have also taken on roles), but Sheeran was given more screen time than any other guest-star and the storyline was left open for him to appear in further episodes.

Speaking about her return to the show, Williams told Entertainment Weekly: “I've always had this fantasy in the back of my head.

“I don't think it's a good ending and fans might not like it, but that somebody would sit on the Iron Throne at the end and then they whip their face off and it's Arya instead. I've always had that dream.”