ATHENS, Greece (AP) " The prime minister of Greece said Tuesday his country had reached an agreement with the country's northern neighbor to end a 27-year dispute over Macedonia's name that has kept the former Yugoslav republic out of NATO.

Greek Prime Minister Alexis Tsipras said in remarks broadcast by state television that a deal had been reached that would give Macedonia a different name that would be used both domestically and internationally.

Tsipras did not, however, immediately reveal what that name will be.

Since Macedonia's independence from Yugoslavia in 1991, Greece has argued that the young country's name implied a claim to the territory and ancient heritage of Greece's northern region of Macedonia " birthplace of ancient warrior king Alexander the Great.

Previous administrations in Macedonia's capital, Skopje, resisted demands to change or modify the name. The dispute poisoned relations between the two neighbors, and the United Nations appointed a special envoy to mediate.

Resolving the dispute would see Greece lift its objections to Macedonia's accession to NATO and the European Union. In Skopje, the opposition party VMRO-DPMNE, said Macedonian Prime Minister Zoran Zaev had informed party leader Hristijan Mickoski that he had "achieved a solution with Greece."

Tsipras' comments came shortly after a much-anticipated phone call with Zaev.

"A short while ago we reached an agreement with the prime minister of the Former Yugoslav Republic of Macedonia on . the disagreement our two countries have" over the name issue, Tsipras told President Prokopis Pavlopoulos.

"We have a good agreement that covers all the preconditions the Greek side had set," he said, adding that Macedonia would revise its Constitution for the name change and that the deal "secures the historic heritage of ancient Greek Macedonia.

Greece is to ratify the deal in parliament after Macedonia has made the necessary changes to its Constitution, Tsipras said.

The compromises to resolve the name issue have faced dissent in both countries, threatening to split Greece's governing coalition and provoke a rift between Macedonia's prime minister and president.

Greek opponents of the deal " which will reportedly rename the Balkan republic as "North Macedonia" " say it would not go far enough.

Defense Minister Panos Kammenos, whose right-wing Independent Greeks party is Tsipras' governing coalition partner, said he would oppose an agreement in a parliamentary vote, meaning the left-wing prime minister will need to seek support from political opponents.

In Skopje meanwhile, Macedonian President Gjorge Ivanov said earlier in the day that he remained opposed to a constitutional change that would likely be included in the draft deal, to provide an assurance that the name change was permanent and binding for domestic and international use.

____

Derek Gatopoulos in Athens, Greece and Jasmina Mironski in Skopje, Macedonia contributed.