The Russians have accused him of becoming a double agent for the United States. The American authorities say he doubled as a cybercriminal while working for Russia’s Federal Security Service, or F.S.B., the main security and intelligence agency in the country.
Mr. Dokuchaev, who was arrested four months ago in Russia, is accused of treason, punishable by 20 years imprisonment, on suspicion of having passed information to the United States.
While the precise nature of that information is unclear, signs have emerged that it may be related, at least indirectly, to the American accusations of electoral hacking.
On Wednesday, federal prosecutors in Washington and San Francisco announced an indictment identifying Mr. Dokuchaev as one of the defendants in the theft of half a billion Yahoo accounts.
“He’s a guy without many options,” said Pavel Vrublevsky, a computer entrepreneur and owner of an online payment processing company in Russia who was investigated in 2011 by Mr. Dokuchaev when he worked as an F.S.B. officer.
The Kremlin on Thursday denied ties to criminal hacking. “We have repeatedly stated that there can be absolutely no question of any official agency, including the F.S.B., in any unlawful actions in cyberspace,” said Dmitri S. Peskov, the Kremlin spokesman.
Mr. Dokuchaev was arrested in December along with another officer in the Center for Information Security, the cyberintelligence wing of the F.S.B. The Russian authorities have offered no details of the charges, but Novaya Gazeta, a Russian newspaper, reported they had been arrested in an investigation into leaks that had led the F.B.I. to Russian servers linked to electoral hacking.
Regardless of the details, the Russian and American cases portend a bleak future for Mr. Dokuchaev, whose career encapsulates ties between criminal hackers and the security services in post-Soviet Russia.
By his own account, he once went by the hacker nickname Forb. According to a 2004 interview he gave to Vedomosti, a Russian newspaper, Mr. Dokuchaev, then 20, worked from home in the provincial city of Yekaterinburg, taking orders from anonymous clients to crash websites and steal passwords.
“I always believed that information should be free,” he told the newspaper. He also said carding, the online theft of credit card numbers, was the most profitable activity for Russian hackers, up to $30,000 a month, but was “the most dangerous cybercrime, punished mercilessly.”
Vitali Kremez, director of research at Flashpoint, a cybersecurity company in New York that monitors underground hacking forums, said that until a few years ago, Mr. Dokuchaev had been actively involved in the world of stolen credit cards.
On those forums, Mr. Dokuchaev inquired about buying skimmers, devices that allow thieves to steal credit card numbers as the cards are swiped. He also sought to buy encoders, used to transfer stolen card numbers onto new plastic cards.
The evolution of a hacker into an F.S.B. officer was all but an open secret in Moscow. Until at least 2011, Mr. Dokuchaev was an editor of a Russian magazine titled Hacker, and he edited a section known as “Breaking In” under the byline Dmitry “Forb” Dokuchaev.
By 2010, Mr. Dokuchaev was already working for the F.S.B.’s Center for Information Security and aiding the prosecution of hackers accused of crashing the online payment system of Aeroflot airlines, according to Mr. Vrublevsky, who was a defendant in that case.
At the time, Russia was under diplomatic pressure from the United States and Canada to prosecute Mr. Vrublevsky on an unrelated charge of selling counterfeit Viagra pills to Americans through websites. Mr. Vrublevsky has denied ties to that scheme.
In the indictment unsealed on Wednesday, the United States authorities indicated that Mr. Dokuchaev’s group also had dabbled in spam marketing for erectile dysfunction drugs.
The American indictment contains no indication Mr. Dokuchaev played any role in Russian electoral hacking. But it identified him as having overseen the work of one of three others named in the indictment, a suspected cybercriminal, Aleksei Belan, whom the Obama administration had sanctioned in December after the United States intelligence agencies concluded Russia had tried to meddle in the election.
Mr. Vrublevsky said he believed the treason arrests that halted Mr. Dokuchaev’s career had been related to the Aeroflot case and other events predating the presidential election.
Amid diplomatic pressure from the United States and Canada to shut down the Viagra scheme, Mr. Vrublevsky said, Mr. Dokuchaev and a colleague had passed information about Russian hackers to the United States, later deemed treasonous.
The information included data on payments through WebMoney, a Russian version of PayPal, used later by American law enforcement investigators to follow the trail to Russian hackers, Mr. Vrublevsky said.
That data, he said, sharpened the Americans’ understanding of Russian hacking, which later aided the investigation of electoral hacking during the campaign.
“America calling him a cybercriminal doesn’t rule out his being a spy as well,” Mr. Vrublevsky said.