Richard Curtis has said he warned Ed Sheeran that his role playing himself in the new film Yesterday would not be as “respectful as it should be”.

The singer plays a send-up of himself in the movie, about a man who wakes up from an accident to find he is the only person who remembers the Beatles, taking over a part originally intended for Coldplay star Chris Martin.

Arriving at the film’s UK premiere, Curtis told the Press Association: “I had written the part for Chris Martin and when Ed said he would do it I did rewrite the part for Ed.

“It wasn’t like there were transferable jokes and I did have to do some work.

“I think the Chris Martin I had portrayed was vainer than the Chris Martin I know in real life.”

He added: “When I sent Ed the script I just said ‘I warn you there are going to a couple of things in here that perhaps aren’t as deeply respectful as they should of Suffolk’s greatest singer songwriter’.

“But he takes the piss out of himself more than anyone.”

“He is a good sport and the thing is it was a very friendly set so he didn’t feel like ‘Oh behind my back people are actually laughing at me’, we were all in on the joke.”

Sheeran, who attended the premiere dressed in a suit and trainers, accompanied by his wife Cherry Seaborn, who also has a cameo in the movie, said: “I thought it would be simpler than it was playing myself, but it was cool.

Yesterday UK Premiere – London
Ed Sheeran at the premiere (Ian West/PA)

“We did it whilst I was on tour so my days off were up in Liverpool.”

Danny Boyle, who directed the film, said it could be “a small step on the path of Ed’s acting career”, adding: “He was great actually. I said to him if you really want to do it well come to rehearsals because guys like that are so busy, there are so many demands on their time, but he did.

“He carved out proper time so he could come and rehearse with the other actors and learn.

Yesterday UK Premiere – London
Sheeran with the cast and crew at the premiere (Ian West/PA)

“Because a lot of acting is picking up a rhythm from other actors and listening to the other actors, not just dong your lines, which is sometimes what happens, celebrities drop in and out of films.

“But he was lovely and it pays off and he’s very funny in the film.”

Yesterday is released in UK cinemas on June 28.