Ed Sheeran has settled a $20 million (£16m) lawsuit in which he was accused of copying another track when penning hit song Photograph.

Sheeran was accused of "note-for-note" copying Amazing, which was released by former X Factor winner Matt Cardle in 2012.

Photograph, from the British star's album x (Multiply), reached number 15 in the UK singles chart in 2014, while Amazing peaked at number 84 in 2012.

A California court order signed on Monday said the case had been dismissed after an agreement had been reached between the parties, but details of the settlement were not revealed.

Songwriters Thomas Leonard and Martin Harrington sued the 26-year-old, accusing him of "unabashedly taking credit" for their work.

They said Sheeran and his songwriting partner Johnny McDaid from Snow Patrol "copied and exploited, without authorisation or credit, the work of other active, professional songwriters on a breathtaking scale".

Harrington, who has written hits for Kylie Minogue, 5ive and Emma Bunton, sued for damages, along with Leonard, of more than $20m.

Leonard and Harrington were represented by Richard Busch, the lawyer who helped the family of Marvin Gaye win a copyright infringement case in 2015.

Gaye's family successfully sued Robin Thicke and Pharrell Williams over their single Blurred Lines, winning a $7.4m (£5.9m) settlement.