Two German men were sentenced on Thursday for hacking computers containing material belonging to Lady Gaga, Dr. Dre and other musicians, stealing their banking data and accessing email accounts.

One of the men, identified as Deniz A, was sentenced to 18 months in prison, according to the International Federation of the Phonographic Industry (IFPI), which aided in the investigation and often publicises court cases involving piracy. Another man, Christian M, received an 18 month suspended sentence.

Both were convicted of copyright theft and computer intrusion, while Deniz A was also convicted of extortion, the IFPI said.

Deniz A, who called himself DJ Stolen, was also accused of obtaining photographs from artist Kesha's computer and trying to blackmail her. Deniz A later apologised to Lady Gaga in a letter that was published in Bild, a German newspaper. Justin Timberlake was also a target of the hackers, who were active between 2009 and 2010.

The IFPI said its investigators noticed a "growing number" of pre-release tracks being leaked earlier than expected. During the two year probe, investigators found the two were sending phishing emails containing files purporting to be music, but were actually Trojan horse programs that collected the authentication details for artists' email accounts.

With those details, the two men downloaded the tracks and then sold them for as much as $1,000, the IFPI said.