Ed Sheeran sang some lyrics from one of his songs in a packed New York courtroom on Thursday.

The singer was also seen playing a few chords on the guitar in front of a jury that is deciding whether Sheeran’s song violates the copyrights of Marvin Gaye’s soul classic Let’s Get It On.

An hour into the testimony in Manhattan Federal court, Ed Sheeran’s lawyer Ilene Farkas pressed him to explain how he came to write his song Thinking Out Loud a decade ago.

This is when he grabbed his guitar from behind the witness stand and explained that writing a song was second nature to him.

Ed Sheeran sang and played his guitar in court when explaining process of creating music

His own version of phonetics were used to create songs so quickly that in one day he could write nine songs, he said.

Sheeran claimed he wrote 10 songs last weekend.

A few words of the song were sung by Sheeran as he made some of the spectators smile in the courtroom of Judge Louis L Stanton.

He sang the words “I’m singing out loud”, loud enough to be heard without raising decibels in the court.

Following the sung words, he then said “and then words fall in” as he explained his method of creating music to the jury.

He said the song was one he worked on with a co-writer, Amy Wadge, who wrote the opening chords.

Despite having performed with some of the world’s greatest artists and becoming a regular at music award shows by age 32, Sheeran said from the witness stand “I’m not the world’s most talented guitar player.”

After bumping his hand on the microphone at the witness stand, he said a quick “sorry”.

The singer then launched into the song that heirs of Ed Townsend, Gaye’s co-writer on Let’s Get It On, say has “striking similarities” and “over common elements” to the famed 1973 Gaye musical treasure.

He sang the words “when your legs don’t work like they used to” as if he might go deeper into the song.

However, after a few bars, he returned the guitar to the rack behind him as his lawyer said to the judge that this was an appropriate time to adjourn for the week.

Two days before this, he had been called to testify by attorneys for the plaintiffs and was adamant in telling jurors that he and Ms Wadge came up with the song without copying anyone else’s music.

He had also said that a video that showed he had segued on stage between Thinking Out Loud and Let’s Get It On wasn’t unusual.

He said it was “quite simple to weave in and out of songs” that are played in the same key.

His lawyer posed friendly questions on Thursday, eliciting from Sheeran how he became interested in music after joining a church choir with his mother when he was four.

Sheeran said: “I can’t read music. I’m not classically trained in anything.”

So he was able to perform three times a night, Sheeran quit school at 17 and played anywhere that would have him from bingo halls to restaurants to “anywhere nobody was”.

He was performing with some of the biggest names in music, from Taylor Swift to the Rolling Stones, 50 Cent to Eric Clapton, within a decade.

Before long, he said, he was writing eight or nine songs a day, explaining: “When inspiration hits, you get excited and it just comes out.”

Near the end of his testimony, Sheeran was asked by his lawyer why an expert called by the plaintiffs had tried to show how chords in Thinking Out Loud resemble Let’s Get It On.

“He was saying that because it helps his argument,” Sheeran said.

The trial will resume on Monday.