The prime ministers of Greece and Macedonia have scheduled a meeting to try to end a longstanding dispute between the neighboring countries over Macedonia's name.

United Nations mediator Matthew Nimetz announced on Saturday that Macedonia's Zoran Zaev and Greece's Alex Tsipras are set to meet Thursday in Bulgaria's capital, Sofia.

Nimetz said the foreign ministers of Greece and Macedonia did "hard, intensive and good work" to lay the groundwork for the Tsipras-Zaev summit.

The prime ministers' talks will be held on the sidelines of a meeting between the European Union and Western Balkans countries working toward EU membership.

Macedonia and Greece have been at odds over the "Macedonia" name for 27 years. Greece claims the country's use of it indicates territorial aspirations on the northern Greek province of the same name.