A 29-year-old man was sentenced to nine months in prison on Tuesday for hacking the online accounts of Jennifer Lawrence and other celebrities and stealing private information, including nude photos.

Edward Majerczyk from Chicago was accused of organising a phishing scheme that tricked victims into giving him usernames and passwords for email and other online accounts.

As well as the jail time, Majerczyk was also ordered to pay $5,700 (€5,300) for counselling services for one undisclosed celebrity whose photos were posted online.

He pleaded guilty last year to one count of unauthorised access to a protected computer to obtain information, and was not charged or accused of selling or posting the material online.

Majerczyk’s lawyer Thomas Needham said in a court filing that his client was "suffering from depression and looked to pornography websites and internet chat rooms in an attempt to fill some of the voids and disappointment he was feeling in his life."

He added that Majerczyk had "consistently expressed remorse" for the hacking and had seen a therapist for anxiety and panic attacks.

No victims' names were mentioned in the court documents.

In 2014, private photos of celebrities including Hunger Games star Lawrence, model Kate Upton and actress Kirsten Dunst were posted online.

Lawrence said that hacking was a "sex crime" in an interview with Vanity Fair magazine.

"It is not a scandal. It is a sex crime," she said. "It is a sexual violation. It’s disgusting. The law needs to be changed, and we need to change. That’s why these Web sites are responsible. Just the fact that somebody can be sexually exploited and violated, and the first thought that crosses somebody’s mind is to make a profit from it.

"It’s so beyond me. I just can’t imagine being that detached from humanity. I can’t imagine being that thoughtless and careless and so empty inside."