Yahoo! Sunnyvale headquarters.

WASHINGTON (Diya TV) — The Justice Department on Wednesday indicted four men, including two Russian spies charging them with directing a criminal conspiracy that broke into 500 million Yahoo accounts in 2014.

According to federal prosecutors, the Russian government then used the information obtained from the intelligence officers and two others named in the indictment — a Russian hacker and a Kazakh national living in Canada — to focus on foreign officials, business executives and journalists. The targets included financial executives, executives at an American cloud computing company, an airline official and even a casino regulator in Nevada.

Details of the attack comes as the United States government is investigating the possibilities of other Russian cyberattacks against American targets, including the theft of emails last year from the Democratic National Committee and attempts to crack the state election systems. Investigators are also having a closer look at communications between associates of President Trump and Russian officials that occurred during the presidential campaign.

One of the outside hackers, a Russian named Alexsey Belan, had been indicted twice before for three intrusions into American e-commerce companies and had been arrested in Europe, but escaped to Russia before he could be extradited. Prosecutors said they received no response to requests from the Russian government to extradite Belan.

The hackers additionally used the Yahoo data to send spam and steal credit card and gift card information, prosecutors said. They also sought to break into at least 50 Google accounts.

Prosecutors unsealed the indictment Wednesday, which contained 47 criminal charges against the two agents of Russia’s Federal Security Service, or F.S.B., as well as two outside hackers with whom they worked with on the scheme. The incident is one of the largest known thefts of data from a private corporation.

It marks the inaugural occasion any Russian F.S.B. official has been indicted on cybercrime charges in the U.S., said Jack Bennett, special agent in charge of the F.B.I.’s San Francisco office. Yahoo worked with the F.B.I. on the investigation for two years, he said.

The four men together face 47 criminal charges, including conspiracy, computer fraud, economic espionage, theft of trade secrets and aggravated identity theft, the Justice Department said in a news release.

The front page of the indictment, which was unsealed Wednesday.

The two agents of the F.S.B. who were charged are Dmitry Aleksandrovich Dokuchaev, 33, a Russian national and resident, and Igor Anatolyevich Sushchin, 43, a Russian national and resident. The other two defendants are Belan, 29, a Russian national and resident; and Karim Baratov, 22, a Canadian and Kazakh national and a resident of Canada. Baratov was arrested on Tuesday in Canada.

“The criminal conduct at issue, carried out and otherwise facilitated by officers from an F.S.B. unit that serves as the F.B.I.’s point of contact in Moscow on cybercrime matters, is beyond the pale,” the acting assistant attorney general, Mary B. McCord, said in a statement.

In a statement, Yahoo thanked the F.B.I. and Justice Department for its work.