ATHENS (Reuters) - Greece and Turkey squared up over old disputes on Thursday during a state visit to Athens by President Tayyip Erdogan that quickly descended into verbal sparring over a list of historical grievances. Designed to boost relations between the two nations, the first visit of a Turkish president in 65 years quickly turned into a blunt grudge-fest between the NATO allies. The two countries agreed to revive a consultation process for confidence-building measures, Prime Minister Alexis Tsipras said. By the end of the first day, both sides appeared to pull back from what threatened to be a massive diplomatic flop.  There is a lot more which unites us, from that which divides us, as long as there is will,  Greek President Prokopis Pavlopoulos told a state banquet in Erdogan s honor.  We can live side by side,  Erdogan said in a translation provided by Greek state TV.  Our aim is to build the future differently, with unity, coexistence and solidarity,  he said. Earlier, he and Erdogan turned what was expected to be a staid welcoming ceremony into an unprecedented bout of diplomatic sparring over a host of differences.   The topics vented ranged from discrimination against Muslims in northern Greece to Turkey s military presence in ethnically-split Cyprus, and loose interpretations of an international treaty defining the borders of the two countries. The 1923 Treaty of Lausanne covered a range of issues and defined the borders of modern-day Turkey, and by extension, Greece. Erdogan told Greek media outlets before he even landed that the treaty needed a revision, putting Greeks in a defensive mode. At the noon meeting, Pavlopoulos ruled out any change to the treaty while a stern-looking Erdogan, seated beside him, said there were details in the treaty which required clarity. Though Erdogan focused on religious rights of the Turkish Muslim community in northern Greece, he said there were also problems on  military topics .  The truth, is I m a little confused regarding if what he is putting on the table is to modernize, to update, to comply with the Lausanne Treaty,  Tsipras said at a news conference as Erdogan stood at his side. SHOW-STOPPER The long exchange between Erdogan and the Greek president was the show-stopper, however.   This is the bedrock of our friendship,  said Pavlopoulos, referring to the treaty and pointedly telling his VIP guest he was a Professor of Law.  It has no flaws, it does not need to be reviewed or updated,  he said. Erdogan responded by saying it was a treaty signed 94 years ago and did not apply only to Greece or Turkey but also included countries such as Japan. It was also supposed to protect the Turkish minority in northern Greece, whom Erdogan said were still discriminated against.  You can t find such treatment of my Greek citizens in Turkey,  Erdogan said in a 30-minute, back-and-forth exchange where notes were slipped to both him and Pavlopoulos by ministers.  Erdogan is the first Turkish president to visit Athens since 1952. He is now doing his best to make sure that the next visit will not take place in the next 150 years,  said Wolfango Piccoli, Co-President of Teneo Intelligence. In Northern Greece, Erdogan said, Greece insisted on calling the Turkish community there Muslim rather than using the term  Turkish . There are more than 100,000 of them in the area known as Western Thrace.  They can t accept the word  Turk  being written outside a school,  said Erdogan, who is due to visit the region on Friday. Tsipras told Erdogan he too had sensitivities on religious freedoms. The Greek government, he said, had moved ahead with the reconstruction of a series of mosques around the country.  Yet not once did it cross our mind to hold an Orthodox religious ceremony in Fethiye mosque (in Athens) as wrongly, in my view, is taking place repeatedly in Hagia Sophia,  he said of the imposing structure in Istanbul that was once a church, converted into a mosque and now a museum. There have been readings of the Koran in Hagia Sophia in recent years. The NATO partners teetered on the brink of war in 1974, 1987 and 1996 over long-running disputes on ethnically divided Cyprus, mineral rights in the Aegean Sea and sovereignty over uninhabited islets in that sea.  We allowed your re-entry to NATO,  Erdogan told Pavlopoulos, referring to the departure of Greece from the bloc in 1974 after Turkey s invasion of Cyprus in response to a brief Greek-inspired coup.  It rejoined in 1980.  If it wasn t for us, you wouldn t have been able to (rejoin),  Erdogan said. While relations have improved, many Greeks believe Turkey has territorial aspirations against their country, an issue Erdogan said on at least two occasions was not the case. 