WASHINGTON – President Donald Trump seemed to misstate the former Soviet Union's involvement in Afghanistan on Wednesday with a convoluted account that sparked ridicule on Twitter.

"Russia used to be the Soviet Union. Afghanistan made it Russia because they went bankrupt fighting in Afghanistan," Trump said during a Cabinet meeting on Wednesday. "The reason Russia was in Afghanistan was because terrorists were going into Russia. They were right to be there."

The former Soviet Union invaded Afghanistan in 1979 to prop up Afghanistan's then- communist government, which was battling anticommunist guerrillas. The U.S. condemned the Soviet move and eventually helped the mujahideen rebel forces. Under then-President Ronald Reagan, the U.S. provided the mujahideen with anti-aircraft missiles, among other assistance.

In part because of U.S. involvement, the Afghan conflict became a quagmire for the Soviet Union, costing Moscow billions of dollars and dealing a blow to the reputation of its Red Army. It was one factor among many that helped lead to the collapse of the Soviet Union.

Political experts seemed taken aback that Trump said Russia was "right" to invade Afghanistan in a Cold War conflict that pit the U.S.S.R. against the U.S.

"I'm old enough to remember when GOP presidents didn't think the USSR was right to invade Afghanistan," Jonah Goldberg, a conservative columnist and political analyst, tweeted after Trump's remarks.

Others suggested Trump had flat-out misstated history.