MOSCOW — Former Marine Paul Whelan was sentenced to 16 years of hard labor in a Russian prison for espionage Monday, the conclusion to a case that has added tension to already strained relations between the United States and Russia.

Whelan, 50, said throughout the trial that he was framed. His attorney, Vladimir Zherebenkov, said his client unwittingly received a flash drive containing “state secrets” while visiting Russia for a wedding in 2018. Foreign Minister Sergei Lavrov said Whelan was caught “red-handed.”

Whelan, arrested on Dec. 28, 2018, has said he thought the flash drive that he received from an acquaintance contained holiday photos. He said Monday that he plans to appeal the court’s decision.

Now that Whelan has been convicted, speculation is rife about a possible prisoner exchange with the United States. Zherebenkov said Monday that “Paul expected this decision because even when he was detained, he was told [by Russian security service agents] that he would be exchanged.”

Without revealing his source, Zherebenkov said he was told Konstantin Yaroshenko, a pilot who was arrested in 2010 for conspiracy to smuggle cocaine into the United States, and Viktor Bout, a gun runner who inspired the 2005 Hollywood film “Lord of War,” are the people the Kremlin is focused on as possible trades for Whelan’s release.

“I heard talk that, why should we waste time on the appeal if we can just go ahead with the exchange?” Zherebenkov said. “I can’t give you any names, but I know that the exchange is being discussed.”

In July, Russian Deputy Foreign Minister Sergei Ryabkov suggested the United States should “free Yaroshenko, swap him for an American or Americans who are serving their sentence here,” according to the Interfax news agency.

“I’m in no position to discuss prisoner exchanges,” U.S. Ambassador to Russia John Sullivan said Monday. “Paul has now just become a convict in the Russian system. I’m advocating for justice for Paul. . . . What we’re looking for is not an exchange; we’re looking for justice for Paul Whelan.”

Even before the verdict was announced, Whelan appeared to believe a guilty result was a foregone conclusion, shouting from within a glass-enclosed area in the courtroom that Russia “feels impotent in the world, so they’re taking political hostages.”

“This is slimy, greasy, rubbish Russian politics — nothing more, nothing less,” Whelan called out to reporters.

After the verdict, Whelan shouted that he had no English interpretation and had no idea what decision was announced.

Speaking on the courthouse steps after the verdict, Sullivan described the case as “a mockery of justice.”

“Is this an impediment? Absolutely,” he said of the relationship between Moscow and Washington, referring to current affairs as at a “low ebb.”

The U.S. Embassy has repeatedly condemned what it called the prosecution’s lack of evidence and described Whelan’s treatment as “shameful.” He was not permitted to phone his family until 16 months into his detainment, and the embassy said he did not have access to English-speaking doctors for a preexisting inguinal hernia.

After experiencing “severe abdominal pain” late last month, Whelan had an “emergency hernia operation” at a Moscow hospital, Whelan’s twin brother, David Whelan, said in an email, citing information from the embassy. The surgery was successful, he said.

Secretary of State Mike Pompeo said Monday in a statement that “the treatment of Paul Whelan at the hands of Russian authorities has been appalling.”

“The United States is outraged by the decision of a Russian court today to convict U.S. citizen Paul Whelan after a secret trial, with secret evidence, and without appropriate allowances for defense witnesses,” the statement said. “We have serious concerns that Mr. Whelan was deprived of the fair trial guarantees that Russia is required to provide him in accordance with its international human rights obligations.”

The trial, which began in March, was largely behind closed doors, with the court citing the classified materials in the case. Proceedings continued despite the strict coronavirus-related restrictions imposed in Russia’s capital.

“Whelan was under surveillance for a number of years; there was a certain script, and there were obvious elements of provocation,” Zherebenkov said. The lawyer added that over the course of many trips to Russia, Whelan got to know about 60 people, “but not a single one has stated that Paul tried to recruit them.”

Whelan, who also has Canadian, Irish and British citizenship, was the corporate security director at BorgWarner, a Michigan-based automotive parts supplier, at the time of his arrest. He received a bad-conduct discharge from the Marines in 2008, according to military records.

“I need the president of the United States and the prime ministers of Canada, Ireland and England to act decisively to end this political charade,” Whelan said in the courtroom Monday.

The Canadian government said Monday that it is “deeply concerned” by Whelan’s conviction and sentencing and that it would continue to provide consular assistance to him and his family.

“The severity of the sentence clearly demonstrates that Russia is using its judicial system as a political tool,” said Angela Savard, a spokeswoman for Global Affairs Canada. “Canada calls upon Russia to ensure a fair and transparent appeal process free of political interference.”

Robyn Dixon and Natalia Abbukomova in Moscow contributed to this report.