LOS ANGELES - A judge on Wednesday dismissed a case against Jay Z in which the heir of an Egyptian composer claimed the rapper illegally used a flute sample in his hip-hop classic “Big Pimpin.”

After a week of testimony in the copyright infringement case, in which lawyers for the plaintiff said the late composer would have been “horrified” to learn his song had been combined with “vulgar” rap lyrics, Los Angeles district judge Christina Snyder abruptly dismissed the suit before it went to a jury.

It was the latest twist in a long-running saga over the flute sample which opens and appears throughout the 1999 song — Jay Z’s first major hit single — which extols the “pimpin” life of casual sex. That sample turned out to come from composer Baligh Hamdi’s 1957 song “Khosara Khosara,” which was written for a movie.

Hamdi’s nephew Osama Fahmy argued that Jay Z and producer Timbaland illegally used the sample without first asking permission. However, the rapper, whose real name is Shawn Carter, and Timbaland, whose real name is Timothy Mosley, testified that they were under the belief they had valid rights to the song.

Timbaland testified that in 2011 he paid $100,000 to EMI Arabia, which said it owned “Khosara Khosara,” for the rights to the song. But Fahmy claimed that deal was irrelevant and that the rapper still had to seek consent for alterations to the original work. “My client is pleased and gratified by the decision,” Jay Z’s attorney Andrew Bart said. Fahmy’s lawyers said they planned to appeal. “We strongly disagree with the ruling and we fully intend to appeal,” attorney Keith Wesley told The Hollywood Reporter. The case is the latest in a string of copyright infringement lawsuits involving major artists. In March, a jury in California awarded Motown legend Marvin Gaye’s children $7.4 million after ruling that singers Robin Thicke and Pharrell Williams plagiarized his music in their song “Blurred Lines.”