A Lancaster, Pennsylvania, resident has been convicted of hacking the private accounts of a number of celebrities — including Jennifer Lawrence, Gabrielle Union and Kate Upton — and sentenced to 18 months in prison Wednesday.

Ryan Collins had negotiated a plea deal with authorities earlier this year, which reduced his jail time from a possible five years. The 36-year-old, who was detained by authorities along with Edward Majerczyk, 28, pleaded guilty to “one count of felony computer hacking and another of unauthorized access to a protected computer to obtain information,” Vogue magazine reported. Collins was taken into custody immediately and began serving his time for felony violation of the Computer Fraud and Abuse Act, reports said.

The private pictures of the celebrities — Lawrence, Upton, Union, along with Kirsten Dunst, Cara Delevingne, Mary-Kate Olsen, Amber Heard, Kim Kardashian and Rihanna — were leaked online, creating the so-called “Celebgate” scandal.

Collins claimed responsibility for hacking “more than 100 Apple iCloud and Gmail accounts, 18 of which belonged to celebrities, using a phishing scam,” but there was no direct evidence of him leaking the photos, for which he was not charged.

“Just because I’m a public figure, just because I’m an actress, does not mean that I asked for this,” Lawrence said in Vanity Fair’s November 2014 issue. “It’s my body, and it should be my choice, and the fact that it is not my choice is absolutely disgusting. I can’t believe that we even live in that kind of world. ”

jennifer lawrence Jennifer Lawrence arrives at the Christian Dior show as part of the Paris Fashion Week Womenswear Spring/Summer 2017 in Paris, Sept. 30, 2016. Photo: Getty Images for Dior/Jacopo Raule

“It is not a scandal. It is a sex crime,” she added. “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."