(CNN) A former Yahoo employee pleaded guilty in a federal court in San Jose Monday to hacking thousands of Yahoo users' accounts and searching for private records, the US Attorney's office in the Northern District of California said in a statement.

Reyes Daniel Ruiz, 34, was mostly interested in sexual images and videos of the account holders, US Attorney David L. Anderson and Federal Bureau of Investigation Special Agent in Charge John F. Bennett said in the statement.

Ruiz, who worked as a software engineer for Yahoo, admitted using the access he had to hack into about 6,000 Yahoo accounts, targeting younger women --- including his personal friends -- and work colleagues, the statement said.

"Once he had access to the Yahoo accounts, Ruiz admitted to compromising the iCloud, Facebook, Gmail, DropBox and other online accounts of the Yahoo users in search of more private images and videos," the office said.

He made copies of images and videos that he found and stored them at home, the US Attorney's office said.

Read More