UPDATED: Katy Perry, co-writer and producer Dr. Luke, their collaborators and Capitol Records are on the hook to pay rapper Flame $2.78 million for borrowed elements in their song “Dark Horse,” a jury decided Thursday afternoon.

The jurors in the copyright case came in with a judgment that Perry should pay Flame (Marcus Gray) $550,000 after determining that her 2013 hit borrowed from his 2008 song “Joyful Noise.” Capitol will be responsible for paying most of the $2.78 million balance.

Attorneys for Perry and Luke did not immediately respond to Variety‘s requests for comment.

Lawyers for Gray and his co-writers had asked for nearly $20 million in the damages phase of the trial, which began Tuesday, after the first phase in which the jury ruled Gray’s song had indeed been copied. Defense lawyers had argued that $360,000 was a reasonable figure.

“These defendants have made millions and millions of dollars from their infringement of the plaintiff’s copyright,” Gray’s attorney, Michael A. Kahn, said in court. Countered the defendants’ attorney, Aaron M. Wais, “They’re not seeking fairness. They’re seeking to obtain as much money as possible.”

The plaintiffs contended that “Dark Horse” was responsible for $31 million coming in to Capitol, counting not just profits from the single itself but the album and live DVD on which it appeared. Capitol disputed that accounting and maintained that after production and promotion expenses, the label’s profits from the song were only $650,000.

Essentially, Gray’s attorney wanted to argue that “Dark Horse” was responsible for virtually the entire success of the entire “Prism” album and its offshoots, while Capitol wanted to argue that, as one of 13 songs on the album (or 16 on the deluxe edition), the album’s earnings should be divided by that many numbers. Clearly, the jury decided that the answer lies somewhere in the middle.

As Variety reported Wednesday, Perry could be off the hook for the damages per her producer contract with producer and co-writer Dr. Luke (Lucasz Gottwald). Such contracts typically indemnify artists from financial damages in the event of a lawsuit from their independent contributions to the song. Perry said as much in her testimony last month, testifying that Luke and Cirkut (Henry Walter) brought her the song’s instrumental track, which suggests the two could have included elements of “Joyful Noise” in the song without her knowledge.

“If the producer brings in their own beats or music that the artist then adds lyrics or a melody to, typically the producer deals indemnify the artist for any breach of warrant, and the warranty would be that all the music is original,” said music attorney Ed McPherson, who specializes in copyright and has handled cases for Lady Gaga, Frank Ocean, Limp Bizkit, Fergie, Linkin Park and others.

Less clear is whether Perry or Luke indemnified Capitol, although the label usually is covered in such situations, and usually by the artist. “In theory, her damages would be limited to what she earned,” McPherson said. “However, she may very well have to pay damages for what the record label and publisher earned as well, through her own indemnity obligations.  The jury will award a percentage of what each individual and entity earns. After they render the verdict, the indemnities will take over, and all of the defendants will have to figure out how they are going to divide the damage payments.”

However, that process may take months or years, as an appeal seems likely. A motion from Perry’s lawyers, requesting U.S. District Judge Christina Snyder to rule that no reasonable jury could find copyright infringement based on the evidence presented at trial, is still pending. If Snyder takes Perry’s side, the damages ruling is moot.