Mr. Erdogan said the 1923 treaty that settled Turkey's borders after World War One was not being applied fairly, the BBC reported.

But Greek President Prokopis Pavlopoulos rejected any change to the Treaty of Lausanne.

Relations between the two NATO members have been uneasy for decades.

Many issues. Long-standing disputes over uninhabited islands in the Aegean brought both countries to the brink of war in 1996.

They have also failed to reach a peace deal in divided Cyprus – the north of the island was invaded by Turkey in 1974 in response to a military coup backed by Athens.

Turkey also says the rights of the Muslim minority of Turkish origin in north-eastern Greece are not being respected. In Athens, Mr. Erdogan said they were not allowed to choose their own mufti, or Islamic legal expert, with the role instead of being appointed by Greece.

Read alsoErdogan: Prove I have cash stashed abroad and I will resign – mediaThe Turkish government is also unhappy with Greece's Supreme Court decision that blocked the extradition of eight Turkish soldiers who fled to the country after allegedly participating in last year's failed coup.

Mr. Erdogan said he urged the extradition of the group.

Meanwhile, Greece complains that Turkey has repeatedly violated its air and naval space.

But tensions between these neighbors date back to the 1830s when Greece won its independence from the Ottoman Empire.

The blunt exchange over the Treaty of Lausanne happened on the first of a two-day visit by the Turkish leader, during a joint press conference.

Mr. Erdogan claimed that the treatment of Muslims in Greece showed that Athens was failing to adhere to the treaty.

"The necessary support is not being provided to them in terms of investments... and there is discrimination going on," he said, complaining also that some points of the treaty needed clarity.

Responding to that, Mr. Pavlopoulos – who is also one of Greece's foremost law experts – said: "This treaty, to us, is not negotiable, this treaty does not have any gaps, does not need a review nor an update. This treaty is valid as it is."

Later, Prime Minister Alexis Tsipras said both countries agreed to launch "confidence-building measures", and said it was important for them to talk calmly about their different perspectives.

Alongside Mr. Erdogan, he added: "We need to express our differences and our disputes in a constructive manner, without hyperbole or provocation, and with respect to the other side's opinion."

The visit, described by Mr. Erdogan as "historic", is taking a place amid a major security operation.

Both governments hope the visit will mark a new chapter in bilateral relations, with joint infrastructure projects being signed off, the BBC's Mark Lowen reports from Athens.