The Katy Perry hit single Dark Horse improperly copied a 2008 Christian rap song, a jury has ruled, in a unanimous decision that represents a rare takedown of a pop superstar and her elite producer by a relatively unknown artist.

Key points: Marcus Gray, known by his stage name Flame, claimed the hit stole from his song Joyful Noise

Marcus Gray, known by his stage name Flame, claimed the hit stole from his song Joyful Noise Jurors ruled in his favour and found all six songwriters and all four corporations that released Dark Horse were liable

Jurors ruled in his favour and found all six songwriters and all four corporations that released Dark Horse were liable The case will now go to a penalty phase, where the jury will decide how much is owed for copyright infringement

The verdict by a nine-member federal jury in a Los Angeles courtroom came five years after Marcus Gray and two co-authors first sued in 2014 alleging Dark Horse stole from Joyful Noise, a song Gray released under the stage name Flame.

The case now goes to a penalty phase, where the jury will decide how much Perry and other defendants owe for copyright infringement.

Questions from the jury during their two full days of deliberations had suggested that they might find only some of the defendants liable for copyright infringement.

The case focused on the notes and beats of the song, not its lyrics or recording, and the questions suggested that Perry might be off the hook.

But in a decision that left many in the courtroom surprised, jurors found all six songwriters and all four corporations that released and distributed the songs were liable, including Perry and Sarah Hudson, who wrote only the song's words, and Juicy J, who only wrote the rap he provided for the song.

Perry was not present when the verdict was read.

Other defendants found liable were Capitol Records as well as Perry's producers, Dr Luke, Max Martin and Cirkut, who came up with the song's beat.

Gray's lawyers argued that the beat and instrumental line featured through nearly half of Dark Horse are substantially similar to those of Joyful Noise.

Katy Perry performed Dark Horse at the Grammy Awards in 2014. ( Reuters: Mario Anzuoni )

Gray wrote the song with his co-plaintiffs Emanuel Lambert and Chike Ojukwu.

Dark Horse, a hybrid of pop, trap and hip-hop sounds that was the third single of Perry's 2013 album Prism, spent four weeks atop the Billboard Hot 100 in early 2014 and earned a Grammy nomination for Perry, who performed it during her 2015 Super Bowl halftime show.

'They're trying to own basic building blocks of music'

Her lawyers argued that the song sections in question represent the kind of simple musical elements that if found to be subject to copyright would hurt music and all songwriters.

"They're trying to own basic building blocks of music, the alphabet of music that should be available to everyone," Perry's lawyer, Christine Lepera, said during closing arguments.

The defendants' musical expert testified that the musical patterns in dispute were as simple as Mary Had a Little Lamb.

Marcus Gray, known by his stage name Flame, released the song Joyful Noise in 2008. ( Twitter: Flame )

But the jury of six women and three men disagreed, finding that the bumping beat and riff at the centre of Joyful Noise were original enough to be copyrighted.

Perry and the song's co-authors testified during the seven-day trial that none of them had heard the song or heard of Gray before the lawsuit, nor did they listen to Christian music.

Gray's lawyers had only to demonstrate, however, that Joyful Noise had wide dissemination and could have been heard by Perry and her co-authors.

They provided as evidence that it had millions of plays on YouTube and Spotify, and that the album it was included on was nominated for a Grammy.

"They're trying to shove Mr Gray into some gospel music alleyway that no-one ever visits," said the plaintiff's lawyer, Michael A Kahn, during closing arguments. He also pointed out that Perry had begun her career as a Christian artist.

Jurors agreed, finding that the song was distributed widely enough that the Dark Horse writers may well have heard it.

Kahn and Gray declined comment but smiled as they left the courtroom after the verdict.

Perry's publicist did not immediately return an email message seeking comment.

AP