Suffolk superstar Ed Sheeran has denied that he "borrows" ideas from other songwriters as he appeared at the High Court for a copyright infringement trial.

The 31-year-old, who grew up in Framlingham, is involved in a legal battle with two songwriters, Sami Chokri and Ross O’Donoghue, who claim his 2017 hit Shape of You rips off parts of their song, Oh Why.

Shape of You was released as a lead single from the star's Divide album and topped the charts in 34 countries.

On Friday, Andrew Sutcliffe QC, for the two songwriters, claimed Mr Sheeran "borrows ideas and throws them into his songs, sometimes he will acknowledge it but sometimes he won’t".

The barrister alleged the acknowledgement depended on how famous the other artist was, adding the two songwriters "are not Shaggy, Coldplay, Rihanna or Jay-Z, if they were they would have been treated in a very different way".

At the start of his evidence on Monday, Ian Mill QC, for Mr Sheeran, asked: "Do you accept that you behave or have behaved in that way?"

Mr Sheeran said "no", before adding: "The examples he has been using are obviously famous artists, two of them are people I’ve made songs with."

The singer continued, saying that "if Mr Sutcliffe would have done his research", he would have known there were "lots" of unknown artists he had cleared parts of songs with.

During the trial, Mr Sheeran gave examples of clearing parts of a song with unknown artists, including when he sampled part of a song from the TV show Buffy the Vampire Slayer.

He said: "All those examples are not famous artists that we’ve cleared songs with and that’s what I have to say on that."

Mr Sheeran further described his songwriting process, telling the court "as I hear a beat, I hear a song and melody comes out.”

Cross-examining, Mr Sutcliffe suggested that: “the evidence is overwhelming that at the time of writing Shape of You, your songwriting process involved collecting ideas,”.

Mr Sheeran replied: “You say it’s overwhelming, I don’t agree with that" later adding, “I write a lot of songs and if I haven’t written a song within two hours, I see it as a failure.”

The songwriter was asked about his previous settlement of a claim in the United States over his hit song Photograph for more than five million dollars.

Andrew Sutcliffe QC, cross-examining, asked if Mr Sheeran had been “fully involved in the negotiation and drafting of the agreement”.

The singer replied: “My lawyers went through it and I trusted their advice.”

The court heard that the agreement included paying 35% of the gross publishing revenues to songwriters Thomas Leonard and Martin Harrington.

Asked if he accepted this was a large sum, Mr Sheeran replied: “I took the advice of my lawyers.”

Mr Sutcliffe later said: “I suggest that you settled it because you thought you would lose.”

“I took the advice of my lawyers,” Mr Sheeran repeated.

The court also heard Sheeran deny that he was “talent spotting” and “plugged in” to the UK music scene in 2015 when Sami Chokri was making a return.

Mr Chokri, who performs under the name of Sami Switch, is one of the songwriters alleging that Mr Sheeran’s hit Shape of You rips off his own track Oh Why.

Andrew Sucliffe QC, representing Mr Chokri, asked Mr Sheeran: “In 2015 you were listening to everything in the UK scene, weren’t you?”

“No,” Mr Sheeran replied, adding later: “I wasn’t plugged in at all”.

Mr Sutcliffe said: “It’s in the middle of 2015 that Sami Switch returns from a two-year absence, at a time when you were talent spotting, plugged in, glued to your screen.”

Mr Sheeran, who told the court he quit social media in late 2015, explained he “wouldn’t be talent spotting” as British artist Jamie Lawson, who had signed to Mr Sheeran’s Gingerbread Man record label, was his “priority”.

He also denied there was a “good chance” he had seen various song and video releases and a tweet featuring Sami Switch in 2015 and 2016.

Mr Sheeran said that for “the whole of 2016” he was “off” social media and using a “flip phone from Tesco”.

The singer has said he does not recall meeting songwriter Sami Chokri, despite Mr Chokri’s claim that they met at a party in a Nando’s restaurant in central London.

In one of his five witness statements, Mr Sheeran said: “I understand that Mr Chokri says that I met him and spoke to him in 2011 at Jamal Edwards’ launch party for SBTV in London Bridge.

“I remember that party. It was at a branch of Nando’s restaurants.

“My career had started to take off at that point and a succession of people wanted to have their picture taken with me. It was extremely busy.

“I have no recollection of meeting anyone there other than someone called Dexter Fletcher, who I am still in contact with. I do not remember meeting Mr Chokri.”

He later added: “Prior to this litigation, I was not aware of either Sami Chokri or Ross O’Donoghue and had not heard of the EP Solace on which Oh Why apparently featured.”

Mr Sheeran said he was “surprised” the claim was pursued, arguing that the part of Shape Of You involved in the case is “very short” and “consists of nothing more than a basic minor pentatonic pattern which is sung using the words ‘Oh I'”.

In his written evidence, he continued: “Both are, in my view, entirely commonplace. Even so, if I had heard Oh Why at the time and had referenced it, I would have taken steps to clear it.”

The singer later added: “I have always tried to be completely fair in crediting anyone who makes any contribution to any song I write.

“I do refer to other works on occasion when I write, as do many songwriters. If there is a reference to another work, I notify my team so that steps can be taken to obtain clearance.

“I have been as scrupulous as I possibly can and have even given credits to people who I believe may have been no more than a mere influence for a songwriting element.

“This is because I want to treat other songwriters fairly.”

In his written evidence, Mr Sheeran said he felt “bruised” by the experience of the unrelated copyright case in the US over his song Photograph.

The singer said he was not aware of the other song, Amazing, at the time and has “no recollection of having heard it before working on Photograph”, adding the claim was “pursued aggressively”.

He said: “This was the first time I had faced this sort of claim.

“I felt bruised by the experience. Even though I felt that I had done nothing wrong, we decided to settle the case because of the money and time it would take to fight it.

“However, that left me with a very bad feeling afterwards.

“The decision to settle felt morally weird given that we were innocent of the allegations made. It made me feel like I did not want to play the song any more.”

Mr Sheeran later described his songs as “excitement bottles” in his written evidence.

Explaining his songwriting process, he said: “There is no premediated thought process, I simply make things up as I go along – and if it sounds good, I keep it.

“I frequently write and record a number of songs in a day. I have recently had a session lasting a week in which I wrote 25 songs.

“Almost all of my songs are written in under two hours.

“I think of them as sort of ‘excitement bottles’ – if a song is working, the excitement pushes it to the point where it’s finished; if it’s not, then I’ll leave it and move on to something else.

“There is therefore nothing unusual for me in the speed with which Shape Of You was created and the vocals recorded.”

Asked whether two “massive hits” had been requested for his album Divide, Mr Sheeran told the court: “They are always trying to push me to get another one, another one… that’s very common for a label.

“I’m always told that I need two massive hits, today they’ll be telling me I need two massive hits.”

Asked what type of music the record label representative had asked for, Mr Sheeran replied: “Rhythmic, always rhythmic. He knows I can do ballads in my sleep.

“I think being a mid-20s bloke you have real ups and real downs and that was the subject matter of a lot of songs that I was writing.”

He later added: “My life is a flurry of songwriting. Every month is a flurry of songwriting.”

Mr Sheeran apologised to the court for errors he made in relation to the disclosure of material during his High Court battle.

In one of his written witness statements, the singer said he had initially confirmed he was satisfied he had complied with his disclosure obligations but had not referred to a box of devices in his home, including tablets and laptops, in relation to a claim in the US over the song Photograph.

Mr Sheeran said he had been aware of the box, but “formed the view” the devices “could not contain any relevant material” and had already been searched for documents relating to that song.

But he said in a written statement: “I now understand that I was wrong to make that assumption, and that I should have searched the devices in the Photograph box for the purposes of giving disclosure in these proceedings.

“I sincerely apologise to the defendants and to the court for that error. I take my disclosure obligations in these proceedings very seriously and understand their significance.”

He also apologised to the court over initially saying he had disposed of a computer he thought he used at the time of creating Shape Of You so it could not be searched.

“If, as appears to be the case, the silver MacBook is the MacBook which I used at the time of creating Shape Of You, then my comments about no longer having that MacBook were wrong,” he said in a written statement, adding: “Again, I sincerely apologise to the defendant and the court for that error.”

Mr Sutcliffe questioned whether Mr Sheeran was a rapper, to which the singer replied: “I mean, what constitutes a rapper? I write songs with raps in them.”

The court heard that part of the writing of the song Eraser, which shares an album with the song Shape Of You, took place within a half-hour period.

Later asked if he needed to see the lyrics of Eraser, Mr Sheeran replied “I wrote this, I know it.”

Mr Sutcliffe later said: “There’s no way you wrote this in 30 minutes.”

Mr Sheeran responded: “I mean, I did, so I don’t know what you expect me to say.”

“I suggest that because it’s not something you normally do, you looked elsewhere for inspiration,” the barrister said.

Mr Sheeran denied this and listed songs he had rapped on from various albums.