An Illinois man accused of breaking into the Apple iCloud and Gmail accounts of celebrities to obtain their private photos and videos has agreed to plead guilty to a felony computer hacking charge, prosecutors said on Friday.

Edward Majerczyk, 28, facing up to five years in prison, is the second man charged in a federal investigation into the leaks of nude photos of several Hollywood actresses, including Oscar winner Jennifer Lawrence, in September 2014.

According to a plea agreement signed by Majerczyk, he illegally accessed Apple iCloud and Google Gmail accounts belonging to more than 300 people, using an email “phishing” ploy to obtain their user names and passwords.

Through this scheme, Majerczyk was able to access full iCloud backups belonging to numerous victims, including at least 30 celebrities, many of whom reside in the Los Angeles area, the plea agreement stated.

“Many of these backups contained sensitive and private photographs and videos,” it said.

Under his deal with federal prosecutors, Majerczyk, a Chicago resident, will formally plead guilty in U.S. District Court in Illinois to a felony violation of the Computer Fraud and Abuse Act, according to the U.S. Attorney’s Office in Los Angeles.

A 36-year-old Pennsylvania man, Ryan Collins, pleaded guilty in March to the same offense in a case stemming from the same investigation.

Like Collins, federal authorities said they had found no evidence linking Majerczyk to actual public circulation of any of the photos to which he gained access.

While no victims were named in court documents, the investigation began after Lawrence and other celebrities, including actresses Kirsten Dunst and Gabrielle Union and model Kate Upton, complained in interviews about having their private photos end up publicly disseminated online.

It was not the first time celebrity nude photos obtained through by computer intrusions led to a criminal prosecution.

A Florida man was sentenced in 2012 to 10 years in prison for hacking into email accounts of Scarlett Johansson, Mila Kunis and Christina Aguilera to leak private information and explicit photos. Pop star Taylor Swift said her Twitter and Instagram accounts were hacked in January 2015.

More recently, a Bahamian man in New York pleaded guilty in May to charges of hacking into celebrities’ email accounts to steal unreleased movies and television scripts. And a Filipino man was charged last month in New Jersey with running a scheme to hack into the bank and credit card accounts of celebrities.