Ed Sheeran has delighted students at a British primary school with a surprise gig.

The singer sang, donated five guitars and gave an "inspirational" speech during his unexpected visit to Fairlight Primary School in Britain last week.

Principal Damien Jordan revealed staff and students were unaware Ed, 33, would be visiting until the moment he arrived – and that he himself only knew the day before.

"I was told that a famous singer wanted to see the music classes at the school," Damien told the BBC.

"I joked with the children that I had bought my mate along – and then Ed Sheeran was there."

He joked Ed wouldn't be the last celebrity to appear at the school.

"Taylor Swift will be in next week, and then Beyoncé the week after," Damien quipped.

Photographer Sadie Avard captured the event and was moved by Ed's "inspirational" words.

"Ed gave us all an inspirational speech which resonated so much with my own experience at school," Sadie wrote.

"His main message was not to be disillusioned by school if you don't quiet fit the expectations of academic life. Don't let it stop you from pursuing the things you love and turning them into your career.

"To find inspiration from others in the industry and work even harder than they do to become best."