Turkey's Prime Minister has arrived in Erbil on the second leg of a trip to Iraq aimed at bolstering Ankara's role in the fight against ISIL.

Binali Yildirim's meeting on Sunday with the head of Iraq's Kurdish region Massoud Barzani follows a meeting on Saturday with his Iraqi counterpart in Baghdad aimed at overcoming differences between the two countries over Iraq's role in the battle to take Mosul from ISIL.

Yildirim is hoping his meeting with Barzani will enhance ties between Turkey and the Kurdistan Regional Government (KRG) over three main issues: the fight against the Islamic State of Iraq and the Levant group (ISIL, also known as ISIS), trade, and Turkey's fight against Kurdish separatists lead by the PKK.

The KRG and Ankara will probably want to continue building on the estimated $8bn worth of trade between the two.

But Turkey's fight against the PKK and other Kurdish groups, who Ankara blamed for numerous bombings across Turkey that have killed hundreds of civilians, will serve as a point of contention between the two leaders.

READ MORE: Turkey vows active role in Syria, better regional ties

Yildirim also met on Saturday with Iraqi Prime Minister Haider al-Abadi, with the relationship between the two governments under pressure.

At the heart of the fallout between the two was the presence of Turkish troops in Baashiqa, a town near Mosul that has served as one of the frontlines in the battle against ISIL.

Baghdad has called for their withdrawal, but Turkey has maintained that their troops would only leave once ISIL was defeated.

Ankara says that their estimated 500 troops in Baashiqa were invited by local forces to help train Iraqi militias and Peshmerga forces in the fight against ISIL, though they never got permission from Baghdad.

"This Turkish delegation came to Baghdad more for economic purposes, as well as to push for certain policies regarding the PKK, in return for their withdrawal from Baashiqa," Metin Gurcan, a military analyst, told Al Jazeera from Istanbul.

"There has been tension since the diplomatic crisis that erupted in October 2016 over Baashiqa, where Baghdad is complaining that Turkey has an uninvited presence," Gurcan added.

"Ankara will agree to withdraw [from Baashiqa], but in return for this gesture, the Turkish government wants the disruption of the PKK's presence in Sinjar region, which connects Iraq to Syria - this region is very important for Ankara."

Gurcan says economic discussions came as Baghdad and Ankara were in "an economic crisis and have an appetite to fix this", including the planning of a new pipeline project that would transport Iraqi oil to Turkey, which would then be able to access global markets.

"It is important to note that there is a very big delegation accompanying the Turkish prime minister, including delegates from the ministries of defence, economy, energy, trade, and especially important Turkish businessmen."