The Justice Department announced charges Wednesday against two Russian spies and two hackers behind the 2014 theft of data connected to half a billion Yahoo accounts, which officials called one of the largest known data breaches in American history.

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.

One of them, Karim Baratov, 22, a Canadian and Kazakh national and a resident of Canada, was arrested in Canada on Tuesday, said Mary McCord, acting assistant attorney general for national security.

Also charged were two agents of Russia’s Federal Security Service, known as the FSB. They are Dmitry Aleksandrovich Dokuchaev, 33, a Russian national and resident, and Igor Anatolyevich Sushchin, 43, a Russian national and resident.

The other defendant, Alexsey Alexseyevich Belan, 29, a Russian national and resident, was already among the FBI’s most wanted cyber criminals, McCord said.

“The criminal conduct at issue, carried out and otherwise facilitated by officers from an FSB unit that serves as the FBI’s point of contact in Moscow on cybercrime matters, is beyond the pale,” McCord said in a statement.

At a news conference, she and other officials described a widespread and complex scheme that allowed the Russian spies to gather intelligence, while the hackers “lined their pockets.”

Related: You Could Have a Yahoo Account and Not Know It

The two FSB officers worked in a section devoted to cyber security, McCord said.

“These are the very people that we are supposed to work with, cooperatively, in law enforcement channels.” McCord said.

Image: Alexsey Alexseyevich Belan

Alexsey Alexseyevich Belan, 29, a Russian national and resident, was charged Wednesday in the 2014 theft of data connected to half a billion Yahoo accounts. Belan was already among the FBI’s most wanted cyber criminals. FBI

Yahoo disclosed in September that hackers breached its network in late 2014 and stole personal data associated with more than 500 million users. The 2014 incident was in addition to a much larger theft that Yahoo disclosed in December and that dated back to 2013.

The two largest hacks, and Yahoo’s much-criticized slow response and disclosure, forced a discount of $350 million in what had been a $4.83 billion deal to sell Yahoo’s main assets to Verizon.