HARTFORD, Conn. (AP) - A Connecticut man charged with hacking into more than 250 iCloud accounts of Hollywood stars and ordinary people has agreed to plead guilty.

Federal prosecutors say the charge against 26-year-old George Garofano stems from the investigation into the 2014 "celebgate" scandal in which the private photos of Jennifer Lawrence, Kirsten Dunst and others were made public.

The North Branford man agreed to plead guilty to unauthorized access to a protected computer. He faces up to five years in prison.

Prosecutors say Garofano sent emails that appeared to be from Apple encouraging victims to reveal usernames and passwords, or to enter them on a website where he could retrieve them.

Garofano's lawyer tells the Hartford Courant his client "is a good person who was taken advantage of" by more sophisticated hackers and is remorseful.

Follow WFMY News 2 on Facebook and Twitter

► Make it easy to keep up to date with more stories like this. Download the WFMY News 2 App now