The firm has plenty of accomplishments to point to. In Russia alone, it upgraded Aeroflot, the national airline, improved traffic flow in Moscow and improved worker safety.

And McKinsey is far from the only American company working in legal ways with companies under sanctions. Some American officials have long argued that getting involved in the Russian economy not only benefits the American companies working there, but can also help foster better business practices and a greater appreciation for democratic principles overseas.

Others see little evidence of that. Robert G. Berschinski, a State Department official in the Obama administration, said business leaders and policymakers often believed that actively engaging with authoritarian governments would lead to economic reform, which in turn would drive political reform.

“But what is becoming increasingly clear, in Russia, China and Saudi Arabia — in all three of those instances — that belief has not proven to be true,” he said.

China is a prime example, argued Mr. Kramer, the former assistant secretary of state. He said the country had lifted hundreds of millions of people out of poverty, yet companies that do business there “have nothing to point to” showing that Chinese people have been granted more civil or political rights.

In some cases, McKinsey’s work may have made things worse.

The firm produced a report tracking how some of Saudi Arabia’s most important policies were viewed by the public, singling out three individuals who drove often negative conversations on Twitter.

One was later arrested, according to a human rights group. Another said that Saudi government officials had imprisoned two of his brothers and hacked his cellphone. The third — an anonymous account — was shut down.