In July, a federal jury stunned the music industry by finding that Katy Perry’s hit “Dark Horse” had infringed on the copyright of a Christian rap song, and the jury later ordered the pop star’s team to pay $2.8 million in damages.

On Tuesday, the judge in that case made an equally surprising move by vacating the jury’s decision, which means that Perry and her collaborators — including her longtime producer Dr. Luke — are not liable for infringement, and therefore do not have to pay damages.

The suit, filed in 2014 by the artist Flame, whose real name is Marcus Gray, drew skepticism in music circles because it contended that Perry’s “Dark Horse” — a No. 1 hit from 2013 — had borrowed a simple eight-note pattern, known as an ostinato, from Flame’s song “Joyful Noise.” (Gray further argued that his reputation as a Christian artist had been harmed by the “anti-Christian witchcraft, paganism, black magic, and Illuminati imagery evoked by ‘Dark Horse.’”)

Christine Lepera, one of Perry’s lawyers, argued at trial that such a basic sequence of notes could not be protected by copyright, and that through his suit Flame was “trying to own the basic building blocks of music.”