RICHMOND, Va. - A former Virginia high school teacher has been sentenced to nearly three years in prison for hacking into private digital accounts of celebrities and others.

Christopher Brannan was the fifth person charged in the 2014 "celebgate" scandal in which hackers obtained nude photographs and other private information from more than 200 people. Actresses Jennifer Lawrence and Mary Elizabeth Winstead are among the celebrities who've said they were victims.

Brannan pleaded guilty in October to aggravated identity theft and unauthorized access to a protected computer.

He apologized Friday before being sentenced to 34 months in prison. He said he suffered from anxiety and depression, and became addicted to pornography.

The 31-year-old Brannan was a special education teacher at Lee-Davis High School in Mechanicsville from 2013 to 2015.