Prime Minister Shinzo Abe has expressed his appreciation to President Recep Tayyip Erdogan for Turkey's assistance in trying to resolve the hostage crisis that ended with Islamic State militants killing two Japanese nationals, officials said.

"Japan will fulfill its responsibility to contribute to stability and peace in Turkey and other Middle Eastern nations," Abe told Erdogan by telephone, according to the officials.

Erdogan relayed his condolences to the families of Haruna Yukawa and Kenji Goto, who were brutally slain in the crisis, and to the Japanese public, according to the officials.

The two leaders agreed to continue enhancing ties between their countries, the officials said.

On Jan. 20, Abe also spoke to Erdogan by phone while he was visiting Israel, after a member of the militant group threatened in a video posted online to kill the two Japanese captives unless Tokyo paid a ransom of $200 million.

At the time, Abe requested Turkey's cooperation in working for the release of the Japanese captives and Erdogan responded that his country would help.