Pointing out that the central government had lost control of 35-40% of Iraqi territory to IS , he said this would not have happened if Sunni politicians had been included from the political process after the US withdrawal in 2011.

Ankara, in turn, accused Maliki of discriminating against Iraq’s Sunni minority and argued this had also spawned radical Sunni groups like the Islamic State (IS). Davutoglu repeated this accusation just before flying to Baghdad on Nov. 20.

Relations, however, remained tense as Maliki continued to accuse Turkey of agitating the country’s minority Sunnis, and contributing to Iraq’s division by finalizing separate energy deals with the Kurdistan Regional Government (KRG).

Davutoglu’s visit also comes shortly after the ice-breaking visit to Ankara by Iraqi Foreign Minister Ibrahim al-Jaafari in early November. The two countries are trying to pick up from where they left off a year ago, when Davutoglu, who was foreign minister at the time, visited Baghdad in an attempt to improve ties.

Prime Minister Ahmet Davutoglu’s visit to Baghdad last week, the first by a Turkish prime minister since 2011, has prepared the ground for improved relations between the two countries following a period of tension under former Iraqi Prime Minister Nouri al-Maliki.

"We told Maliki not to exclude Sunnis, to fulfill his promises to Kurds and keep Turkmen and different Shiite groups in the political system," Davutoglu told the state broadcasting channel TRT.

Prospects for ties between Turkey and Iraq improved markedly after Maliki was forced out and a new government was formed in September under Haider al-Abadi, a prominent Shiite who has promised to unify the country. The new atmosphere in ties was also apparent during Davutoglu’s visit when he was received warmly by Abadi and other Iraqi officials and politicians.

During his news conference with Abadi following their talks, Davutoglu stressed Turkey’s pleasure at seeing an inclusive government in Baghdad. “Iraq’s stability and peace is Turkey’s stability and peace,” Davutoglu said in expressing Ankara’s commitment to a unified Iraq where there is no discrimination on the grounds of ethnicity, religion or sectarian affiliation.

Davutoglu added that Ankara’s position concerning the threats facing Iraq, especially from IS, was also clear. “Structures that threaten Iraq also threaten Turkey,” he said, also including the Kurdistan Workers Party (PKK) among these “structures.”

Saying that his visit aimed to inject a new dynamism into ties, Davutoglu indicated that one of the subjects agreed upon during his talks with Abadi was to resume the joint Cabinet meetings between the two countries last held five years ago.

He said agreement had been reached to hold one Dec. 24-26 during a proposed visit by Abadi to Turkey.

There are, however, problems that have yet to be overcome. Turkey’s bilateral ties with the KRG, especially in the energy field, continue to pose an issue for the Iraqi government.

Jaafari told journalists in Ankara on Nov. 7 that they still wanted the money in Turkish banks obtained from the sale of oil by the KRG on the international market independent of the central government.

“We know our money is in safe hands. We have not raised this issue this time but it will be on the top of our agenda in our upcoming meeting with the Turkish side,” he said, indicating that this matter had yet to be resolved.

That money remains in Turkey’s state-owned Halkbank, but there is no clear indication as to what the amount is. Ankara has justified giving permission to the KRG to ship oil using the Turkish port of Ceyhan on the grounds that the Maliki government did not honor the constitutional stipulation concerning the proportional distribution of oil revenues between the central government and the KRG.

Ankara nevertheless refers to the KRG’s oil revenues in Halkbank as money belonging to Iraq, and has been underlining its desire to see the KRG and Baghdad resolve their differences. Recent positive developments have raised hopes that this might happen.

Baghdad agreed last week to transfer $500 million to Erbil, the KRG capital, in a resumption of budget allotments for October 2014. The KRG agreed in return to deliver 150,000 barrels of oil to Iraq’s State Oil Marketing Organization.

These are overtures that Turkey is encouraging as Kurdish officials and officials from the central government prepare to meet in the coming days to try and chart a new course in relations.

Meanwhile, advances made by IS in Iraq have changed the equation in favor of the Iraqi Kurds, according to analysts who point out that Baghdad has not been able to export oil over the pipeline connecting Kirkuk and Ceyhan in Turkey because of this.

As Barbara Slavin indicates in her Nov. 20 post for Al-Monitor, new Iraqi Oil Minister Adel Abdul-Mahdi has conceded that Baghdad now values a pipeline from northern Iraq to Turkey, even though it once opposed it.

“Rather than being totally left out of Erbil’s oil projects, Baghdad appears to have understood the advantages of participating in these based on the logic of turning its losses to advantage,” said Bilgay Duman, a researcher at the Ankara-based Center for Middle East Strategic Studies.

Duman also said that Davutoglu’s visit to Iraq shows that Turkey’s ties with the Iraqi government and the KRG are not alternatives to each other but are complementary. This was made clear by Davutoglu who moved on to Erbil from Baghdad and held talks with KRG President Massoud Barzani.

Davutoglu underscored Turkey’s commitment to economic and political ties with the KRG. Ankara has also added a security dimension to these now by sending Turkish military advisers to northern Iraq to train Kurdish peshmerga fighters against IS. Meanwhile, Kurdish sources are admitting that they have received weapons from Turkey, too.

During a news conference with Barzani in Erbil, Davutoglu also underlined the fact that $8 billion of the $12 billion of the trade with Iraq was done with the KRG, and said Turkey's economic ties with northern Iraq are constantly increasing.

Erdal Tanas Karagol of the Ankara-based Foundation for Political, Economic and Social Research maintains that Davutoglu’s visit to Iraq shows Turkey is “the guarantor of energy peace” in Iraq. He argues that the point that has been arrived at today, in a process that began in May with the sale of Kurdish oil through Turkey, has vindicated Ankara’s policy in this regard.

The general picture following Davutoglu’s visit indicates a much better environment for political and economic cooperation between Ankara, Baghdad and Erbil than in recent years. There are, nevertheless, those who maintain a cautious approach in this regard.

One such person is retired Ambassador Osman Koruturk, who served as Turkey’s special envoy to Iraq in 2003-2005. He told Al-Monitor that Davutoglu’s line that once Maliki’s sectarianism was removed, things started to fall into place in Iraq, is too simplistic.

“Sectarian affiliations remain important in Iraq and cannot be overlooked. Turkey should expand its spectrum in that country and reach out to the Shiites by establishing close ties with them,” said Koruturk, a deputy from the opposition Republican People's Party.

He believes the best way to do this is through the Iraqi Turkmens, who are related to Turks by ethnicity even though the majority of them in that country are Shiite, unlike the majority of Turks, who are Sunni.

Koruturk said this would also show that Turkey, which has been accused of Sunni leanings in Iraq and Syria, is not motivated by any sectarian considerations itself. Koruturk nevertheless conceded that Davutoglu’s trip to Baghdad and the current dynamics in ties between Turkey and Iraq are positive developments.