Macedonia and Bulgaria have signed a friendship treaty in an attempt to end years of feuding and boost Macedonia's bid to join the European Union.

Macedonia's rocky relations with its bigger eastern neighbor have hampered its efforts to join NATO and the EU, although the two nations share close religious, historic, and linguistic ties.

Bulgaria still does not recognize the Macedonian language, which it views as a dialect of Bulgarian.

Both Skopje and Sofia hope the new treaty will help them set aside such differences.

The friendship treaty is a "joint contribution to political stabilization between the two countries and in the region," Macedonian Prime Minister Zoran Zaev said in Skopje after co-signing the pact with visiting Bulgarian Prime Minister Boyko Borisov.

In the document, Bulgaria, already a NATO and EU member, pledged to support Macedonia's efforts to join both. The two countries said they would also improve economic ties, renounce territorial claims, and improve human and minority rights.

The treaty calls for an "objective" reexamination of the common history of Bulgaria and Macedonia, a process that could lead to a review of school textbooks.

Macedonian schoolchildren are still taught that their country was occupied by Bulgaria, a Nazi ally during World War II.

The two countries have also agreed to open a train line from Sofia to Skopje.

"For the first time, without mediators or somebody telling us what to do, the two states came to a solution," Borisov said. The treaty "shows the EU that the turbulent Balkans, which have passed through a lot of troubles, can solve problems by agreements without mediators," he said.

"If you look back, you will stumble and fall," Borisov said. "So we decided to look ahead. I am convinced that in 10 years the results will be visible."

Last week, the Bulgarian parliament unanimously supported the treaty in a rare case of such consensus in the Black Sea country of 7.1 million people.

However, Macedonia's opposition and the former ruling party, the rightist VMRO-DPMNE, denounced the treaty as a "capitulation" to Bulgaria and said it would not support the treaty in parliament.

EU and German officials warmly greeted the agreement. EU foreign-policy chief Federica Mogherini and Enlargement Commissioner Johannes Hahn said in a joint statement that the treaty "is an inspiration for the whole region."

German Foreign Minister Sigmar Gabriel said it was "remarkable" the treaty was signed less than two months after Zaev's new government took office. Gabriel said he was counting on Skopje to "continue pursuing this form of constructive cooperation with all its neighbors."

With reporting by AP, AFP, RFE/RL's Balkan Service, and Reuters

