Two agents of Russia's FSB spy agency and two "criminal hackers" were indicted over a massive cyber-attack affecting 500 million Yahoo users, the US Justice Department said.

The indictment unveiled on Wednesday in Washington, DC, links Russia's top spy agency to one of the largest online attacks in history, carried out in 2014. Officials said that it was launched for espionage and financial gain.

The US government alleged that the content of at least 30 million accounts was accessed as part of a spam campaign, and at least 18 people who used other internet service providers, such as Google, were also victimised.

Officials identified the agents as Dmitry Dokuchaev and Igor Sushchin, both of whom were part of the successor agency to Russia's KGB.



The two officers "protected, directed, facilitated and paid criminal hackers to collect information through computer intrusions in the United States and elsewhere", Mary McCord, the acting assistant attorney general, told reporters.



They hired Alexsey Belan and Karim Baratov, described as "criminal hackers", to carry out the attacks.



"The defendants targeted Yahoo accounts of Russian and US government officials, including cyber-security, diplomatic and military personnel," McCord said.



"They also targeted Russian journalists, numerous employees of other providers whose networks the conspirators sought to exploit, and employees of financial services and other commercial entities."

Washington has not contacted Moscow over charges against the Russians, Russian news agencies reported on Wednesday, citing a "highly placed" source in Moscow.

The source was also quoted by TASS, RIA and Interfax as saying that the topic of "Russian hackers" was part of an internal political struggle in the United States.

McCord said Baratov was arrested this week on a US warrant in Canada. Information on the other suspects was not immediately available.

The attack on Yahoo, disclosed last year, was one of the largest ever data breaches and at the time was blamed on a "nation-state" attacker.

OPINION: Russia's soft warfare

Al Jazeera's White House correspondent James Bays said there was "no direct link" between the Yahoo hack and the hacking of Democratic Party emails, which took place during the 2016 US presidential election.

US intelligence agencies have said that those were carried out by Russia in order to help the campaign of Republican President Donald Trump.

"But the fact that [the US government is] charging two members of the FSB - the successor to the old Soviet KGB - shows the sort of cyber activities that the Russian government may be involved in," said Bays.

"Clearly, there are still questions about the election campaign and what Russia was up to there, and whether there was any collusion with members of the Trump campaign, or anyone linked to him."

Yahoo said, when it announced the then-unprecedented breach last September, that it was working with law enforcement authorities and believed the attack was state-sponsored.

The company announced a still-larger breach in December that occurred in 2013 and affected one billion accounts.