Turkish President Recep Tayyip Erdogan warned his French counterpart Emmanuel Macron "not to mess" with Turkey, as tensions between the NATO allies escalated.

"Don’t mess with the Turkish people. Don’t mess with Turkey," Erdogan said during a televised speech in Istanbul on the 40th anniversary of the 1980 military coup.

Macron has strongly condemned Ankara during a standoff between Greece and Cyprus on one side and Turkey on the other over hydrocarbon resources and naval influence in the eastern Mediterranean.

Erdogan urged Greece to "stay away from wrong" actions backed by countries like France in the disputed waters, after rival naval exercises by Athens and Ankara in the region last month saw Paris step up its military presence in the region.

Macron on Thursday said Europeans must be "clear and firm with, not Turkey as a nation and people, but with the government of President Erdogan which has taken unacceptable actions."

The French leader was speaking before the summit of the EU's seven Mediterranean nations which threatened Turkey with sanctions over its activities.

The latest tensions began after Turkey deployed the Oruc Reis research vessel and warships to the disputed waters on August 10 and prolonged the mission three times.

But the Turkish leader on Saturday dismissed such remarks and accused Macron of "lacking historical knowledge".

"Mr Macron, you re going to have more problems with me," Erdogan threatened.

They were his first comments directly taking aim at the French leader after remaining silent during the latest row.

He also said France "couldn t give a lesson in humanity" to Turkey, and told Macron to look first at France s own record, notably in Algeria and its role in the 1994 Rwandan genocide.

Demonstrating the ire Macron s comments have raised, Erdogan on Saturday evening again took aim at the French leader. "Macron, you already don t have much time. You re on your last legs," Erdogan said during a speech in Istanbul as part of a campaign to sign up new members to his ruling party.

The next French presidential election will be in 2022.

Relations between Turkey and France have deteriorated over the eastern Mediterranean, but the two allies disagree on other major issues including the Syria and Libya conflicts.

Ankara and Paris have previously traded barbs after French officials in 2018 met with Syrian Kurdish leaders linked to a US-backed militia viewed by Turkey as "terrorists".

The two countries are also on opposing sides in Libya, where Ankara backed the UN-recognised Government of National Accord in Tripoli against a 2019 offensive by military leader Khalifa Haftar.

France is suspected of supporting Haftar, but insists it is neutral in the conflict.

Erdogan accused France in his first speech on Saturday of intervening in Libya "for petrol", and in Africa for "diamonds, gold, copper".