Turkey has prided itself on its good ties with the autonomous Kurdistan Regional Government (KRG) in Iraq's north, with its leader Massud Barzani a frequent visitor to Ankara.
But even as Turkish investment poured into the regional capital of Arbil, Turkey has always kept a wary eye on any moves towards full independence.
Ankara is still battling a more than three-decade insurgency by the Kurdistan Workers' Party (PKK) for autonomy in southeast Turkey that has claimed tens of thousands of lives.
"Making a step towards independence in the north of Iraq is an error and a threat for the territorial integrity of Iraq," Erdogan said in a speech to his party in Ankara.
More From This Section
Barzani announced on June 7 that a referendum would be held in Kurdish areas of Iraq on September 25 to ask voters if they want a separate state.
The vote is nonbinding, but the move was greeted with irritation by Baghdad.
Widely seen as the world's largest stateless people, most Kurds are spread between Iran, Iraq, Syria and Turkey. But it is only in Iraq where they have achieved a recognised autonomy.
Iraqi Kurdish oil is exported through Turkey, a key economic lifeline for the region.
The PKK, for its part, maintains rear bases in the mountains of northern Iraq even though Barzani has repeatedly expressed discomfort at their presence.