A Canadian man of Kazakh origins has been arrested in Ontario as one of four suspects in a massive hack of Yahoo emails, Toronto police said Wednesday.

Karim Baratov, 22, was taken into custody in Ancaster, Ont., on Tuesday at the request of American authorities, a police spokesman said.

"Our job was to locate and arrest one of the people," Mark Pugash told The Canadian Press. "We did that safely without incident."

In a release, the U.S. Department of Justice said a grand jury in California has indicted Baratov and three others, two of them allegedly officers of the Russian Federal Security Service, for computer hacking, economic espionage and other criminal offences.

According to the department, the four are alleged to have hacked into Yahoo's systems and stolen information from more than 500 million user accounts.

"(They) then used some of that stolen information to obtain unauthorized access to the contents of accounts at Yahoo, Google and other webmail providers, including accounts of Russian journalists, U.S. and Russian government officials and private-sector employees of financial, transportation and other companies," the department alleged.

"One of the defendants also exploited his access to Yahoo's network for his personal financial gain, by searching user communications for credit-card and gift-card account numbers."

Officials alleged the conspiracy began in January 2014.

Toronto officers were involved because its fugitive squad has a strong reputation, Pugash said. He could offer no further information about Baratov but said the suspect had been turned over to the RCMP.

"This was a very large operation," Pugash said. "Our job was that final part of it, which was to locate and arrest him."

Mountie spokesman Sgt. Harold Pfleiderer said the RCMP assisted the FBI in its investigation.

U.S. officials said Baratov also went by the names Kay, Karim Taloverov and Karim Akehmet Tokbergenov.

Also indicted in the alleged conspiracy were Dmitry Aleksandrovich Dokuchaev, 33, Igor Anatolyevich Sushchin, 43, and Alexsey Alexseyevich (Magg) Belan, 29, all Russian nationals and residents. Dokuchaev and Sushchin are said to be Russian intelligence agents who allegedly masterminded and directed the hacking, the department said.

The charges against the four were announced by top American justice and security officials, including Attorney General Jeff Sessions and FBI Director James Comey.

"Cyber-crime poses a significant threat to our nation's security and prosperity, and this is one of the largest data breaches in history," Sessions said in a statement.

Belan, who had previously been indicted in 2012 and 2013, was named one of FBI's most wanted cyber-criminals in November 2013 but escaped to Russia before he could be extradited from Europe, the department said.

Based in Sunnyvale, Calif., Yahoo was already facing a proposed $50-million class action on behalf of Canadians whose personal information may have been stolen. The company informed the representative plaintiff, Natalia Karasik, of Barrie, Ont., late last year that her information was part of a hack of its servers in 2013.

In September, Yahoo sent a mass email to users to inform them that their account information had been stolen from its network in a cyberattack in late 2014. The information included email addresses, telephone numbers, dates of birth, passwords and security questions. The company said at least 500 million user accounts were affected.

Yahoo also faces class actions in the United States.