U.S. Secretary of State John Kerry called Wednesday for "an ultimate resolution" of the two-decade-old Nagorno-Karabakh conflict between Azerbaijan and Armenia during talks with Azeri President Ilham Aliyev at the State Department.

Aliyev is in Washington for a two-day nuclear security summit hosted by President Barack Obama on Thursday and Friday.

"We want to see an ultimate resolution of the frozen conflict of Nagorno-Karabakh that needs to be a negotiated settlement and something that has to be worked on over time," Kerry said during a brief photo opportunity with Aliyev.

The conflict broke out in the dying years of the Soviet Union, but efforts to reach a permanent settlement have failed despite mediation led by France, Russia and the United States. Nagorno-Karabakh lies inside Azerbaijan but is controlled by ethnic Armenians.

Aliyev thanked the United States for trying to end the conflict but said it could be resolved only through a U.N. Security Council resolution calling for the "immediate and unconditional withdrawal of Armenian troops" from Azerbaijan.

"The conflict between Armenia and Azerbaijan, all the conflicts in post-Soviet area and in the world, must be resolved based on territorial integrity of the countries," he said.

Oil-producing Azerbaijan frequently threatens to take the mountainous Nagorno-Karabakh region back by force. Clashes around the region have fueled worries of a wider conflict breaking out in the South Caucasus, which is crossed by oil and gas pipelines.