Iranian President Ebrahim Raisi makes his first official visit to Turkey on Tuesday, hoping to paper over past differences and forge a forceful joint response to Israel's actions in Gaza.
Turkish President Recep Tayyip Erdogan has emerged as one of the Muslim world's most vocal critics of Israel's onslaught on Gaza in response to Hamas militants' October 7 attack.
He has branded Israel a "terrorist state" and called Iran-backed Hamas "a liberation group".
Erdogan has also suggested trying Israeli politicians and military commanders in the International Criminal Court in the Hague.
But past meetings between Muslim and Arab leaders -- including talks this month in Riyadh -- have failed to find common ground over what immediate economic and political steps to take.
Analysts believe that Raisi will pressure Turkey to move past the rhetoric and cut its blossoming trade and energy relations with Israel.
"Iran expects Turkey to end its direct and indirect trade with Israel," Istanbul's Centre for Iranian Studies director Hakki Uygur told AFP.
"Turkey, on the other hand, has taken an attitude that cares about separating political and commercial issues."
According to Gaza's Hamas-led government, nearly 15,000 people -- mostly civilians and including thousands of children -- have died since Israel began to retaliate for Hamas's unprecedented cross-border attacks in which Israel says 1,200 people, mostly civilians, died.
Raisi's visit comes with efforts focused on extending a truce that has seen dozens of Israeli hostages freed in return for the release of more than 100 Palestinian prisoners.
Iran and Turkey share a 535-kilometre (330-mile) border and a complex history of close economic relations and opposing views on regional disputes.
Turkey backed rebel efforts to topple Iranian and Russian-backed President Bashar al-Assad during Syria's civil war.
Ankara's support for Azerbaijan's two victorious wars over Armenian separatists in Nagorno-Karabakh also created deep unease in Iran.
Tehran fears that Baku's resurgence in the Caucasus region could feed the separatist ambitions of Iran's large ethnic Azerbaijani minority.
Iran is also anxious about a proposed trade route running along its northern border between Azerbaijan and Turkey that could potentially complicate its access to Armenia.
"The most important conflict between Turkey and Iran was over the Caucasus and Karabakh," Ankara-based Iran expert Arif Keskin said.
"With the Gaza conflict, this issue was pushed to the back burner, but it still remains there as an important issue," Keskin told AFP.
The Turkish presidency said Erdogan discussed finding "a common stance against Israel's brutality" by phone with Raisi on Sunday.
Analysts believe that Iran is trying to calibrate the extent to which it uses groups such as Hamas and Hezbollah in Lebanon to pressure Israel and the United States.
"Iran has been wary of intervening in the ongoing Middle East crisis and is likely to avoid any action that might escalate the conflict," the Eurasia Group said in a report.
"As Iran does not have total control over its allies, there is a risk that unintended actions bring US retaliation and escalate the conflict," it said.
Erdogan has also voiced repeated worries about the spread of war.
"Iran and Turkey will continue to work in unity to make the temporary ceasefire permanent and achieve permanent peace," Erdogan's office said after his call with Raisi.