SAN FRANCISCO (AP) - A Canadian computer hacker has been sentenced to five years in prison in connection with a massive security breach at Yahoo that federal agents say was directed by Russian government spies.

A federal judge in San Francisco also fined 23-year-old Karim Baratov $250,000.

Baratov pleaded guilty in November to nine felony hacking charges.

He acknowledged hacking thousands of webmail accounts for seven years ending with his arrest last year.

Baratov charged customers to obtain another person's webmail passwords by tricking them to enter their credentials into a fake password reset page.

Copyright 2018 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.