WASHINGTON — President Obama sat side by side with Ukraine’s new acting prime minister Wednesday and declared the country can’t operate with the “barrel of a gun” pointed at it.

Speaking in the Oval Office to convey the maximum embrace of Ukraine’s fledgling government, Obama called out Russian President Vladimir Putin by name for Russia’s invasion of Crimea.

“They cannot have a country outside of Ukraine dictate to them how they should arrange their affairs,” Obama said after a meeting with visiting Ukrainian Prime Minister Arseniy Yatsenyuk.

He said Ukraine and Russia could discuss “different arrangements” in Crimea,

“But that’s not something that can be done with the barrel of a gun pointed at you,” Obama added.

He mocked the upcoming Sunday referendum in Crimea as a “slapdash election.” Voters in the region, now effectively under Russian military control, will choose between further autonomy and whether to be absorbed into Russia.

Obama said if Russia continues on its path, the US and the international community “will be forced to apply a cost to Russia’s violation of international law.”

Yatsenyuk, a 40-year-old economist known as a technocratic reformer, spoke in English in terms meant to appeal to a US and European audience.