An Oregon man has admitted he tricked hundreds of people into divulging their Apple and Gmail passwords in a scheme that allowed him to steal nude images of more than a dozen victims, some of them celebrities.

Andrew Helton, 29, of Portland, entered the plea on Thursday to one felony count of unauthorized access to a protected computer to obtain information, according to documents filed in federal court in Los Angeles. Prosecutors said he gained illegal access to 363 Apple and Gmail accounts, including those belonging to members of the entertainment industry in Los Angeles. He then used the access to obtain data stored in the online accounts, including 161 sexually explicit, nude, or partially nude images of 13 people, some who were unidentified celebrities.

According to a plea agreement unsealed Friday, Helton engaged in a fraud campaign from March 2011 to May 2013 in which he sent e-mails that falsely claimed to come from Apple or Google. The phishing e-mails asked victims to verify their accounts by clicking on links that led to what looked like authentic Apple or Google login pages. When targets complied, their passwords were transmitted to Helton, who used them to illegally access account data.

There's no indication if any of the images Helton stole were among the collection of nude photos of as many as 100 celebrities that were published on the Internet in 2014 . A hacker who took responsibility for the postings said the images were taken from the compromised iCloud accounts belonging to the victims. Apple later said the compromised accounts were the result of a targeted attack on user names, passwords, and security questions.

Helton faces a maximum sentence of five years in prison. A sentencing hearing is scheduled for June 2.