President Donald Trump on Wednesday spoke approvingly of the Soviet Union's 1979 invasion of Afghanistan as he made a number of inaccurate assertions about Russian and Afghan history.

Trump inaccurately said the Soviet Union invaded Afghanistan to fight "terrorists" and falsely said they went "bankrupt" because of the war.

"The reason Russia was in Afghanistan was because terrorists were going into Russia. They were right to be there," Trump said.

Trump's comments came amid criticism of his foreign policy and in the wake of the resignation of Defense Secretary James Mattis.

President Donald Trump spoke approvingly of the Soviet Union's 1979 invasion of Afghanistan during a Wednesday Cabinet meeting as he made a number of inaccurate assertions about Russian and Afghan history.

Trump said the Soviets invaded Afghanistan to fight terrorists, which is not true. The president also said the Soviet Union went "bankrupt" because of its decadelong involvement in the Afghan War, which is inaccurate.

"Russia used to be the Soviet Union. Afghanistan made it Russia because they went bankrupt fighting in Afghanistan," Trump said.

"The reason Russia was in Afghanistan was because terrorists were going into Russia. They were right to be there," the president added. "The problem is it was a tough fight. And literally they went bankrupt. They went into being called Russia again as opposed to the Soviet Union. A lot of these places you're reading about now are no longer part of Russia because of Afghanistan."

It's not clear whom or what Trump was referencing when he said the Soviets invaded Afghanistan because of "terrorists." The White House did not immediately respond to a request for comment from INSIDER.

The Soviets invaded Afghanistan in 1979 to prop up a communist government that gained power via a coup in the previous year. The pro-Soviet Afghan government did not enjoy popular support among the overwhelmingly Muslim population.

Over the course of the latter half of the 20th century, the US dedicated much of its energy to thwarting the Soviet Union and the spread of communism across the globe, including in Afghanistan. The CIA actively aided Afghan rebels who fought against the Soviets.

Trump made no reference to the US government's efforts to undermine the Soviet invasion and occupation of Afghanistan during Wednesday's Cabinet meeting.

The Soviets ultimately withdrew from Afghanistan in 1989 after nearly 10 years of occupation and hard fighting. Nearly 15,000 Soviet troops had been killed by the time of the withdrawal. A civil war raged on in the years that followed, and the communist government was overthrown in 1992. The Taliban, which was originally formed in the early 1990s by a group of Islamic militants who fought against the Soviets, took over Afghanistan in 1996.

The Soviet Union collapsed on December 25, 1991, and historians and foreign policy scholars have since been engaged in an ongoing debate about why this occurred. There is truth to the notion that the Afghan war contributed to the demise of the Soviet Union, but it's hyperbolic to say the conflict was the primary catalyst for its downfall. There were myriad political, social, and economic factors that led to the Soviet Union's fall in the early 1990s.

Leon Aron, the director of Russian studies at the American Enterprise Institute, in an op-ed for Foreign Policy wrote that the cost of the Afghan war for the Soviets was "hardly crushing."

"Of course, Afghanistan increasingly looked like a long war, but for a five-million-strong Soviet military force the losses there were negligible," Aron said. "Indeed, though the enormous financial burden of maintaining an empire was to become a major issue ... the cost of the Afghan war itself was hardly crushing: Estimated at $4 billion to $5 billion in 1985, it was an insignificant portion of the Soviet GDP."

Trump's comments on Wednesday came amid criticism of his foreign policy and in the wake of the resignation of Defense Secretary James Mattis.

The president is reportedly looking at withdrawing roughly half of the 14,000 US troops stationed in Afghanistan, even as the Taliban controls or contests approximately half of the war-torn country's districts.

The military community, including the former top US commander in Afghanistan, has warned Trump that cutting troops would reduce US leverage on the Taliban and make it more difficult to negotiate a peace deal. But the president seems determined to ramp down the nearly 18-year-old conflict as soon as possible to make good on promises he made during his presidential campaign.