A police officer walks past the flags of Eritrea and Ethi­o­pia in Addis Ababa, Ethi­o­pia, on Friday. (Tiksa Negeri/Reuters)

WHEN ETHIOPIAN Prime Minister Abiy Ahmed stepped off his plane in Asmara, the capital of Eritrea, last Sunday for long-awaited peace talks, he surprised the world by warmly embracing Eritrean President Isaias Afwerki. The two countries had been at loggerheads for more than 20 years, but the show of camaraderie between their leaders augured a rapprochement. Hours later, they signed a declaration that proclaimed the end of hostilities between them and announced a new era of normalized relations.

As part of the declaration, Ethiopia and Eritrea agreed to restore the diplomatic, trade and transportation links that were severed during the border war they fought between 1998 and 2000. To the delight of families that have been kept apart by the dispute, they will reopen embassies, flight routes and direct telephone lines. Eritrea also agreed to give Ethiopia access to its ports on the Red Sea, while Ethiopia signaled that it would respect a 2002 boundary ruling that awarded territory to Eritrea. These commitments, along with more general pledges to improve political, economic and cultural cooperation and regional peace, will do much to strengthen trade, security and development in the Horn of Africa.

The agreement is a diplomatic coup for Mr. Abiy, whose first 100 days in office have brought an encouraging turnaround in Ethi­o­pia after years of authoritarian rule. He made the first overtures to Eritrea last month, when he announced that Ethiopia would withdraw troops from disputed territory on the border. His willingness to enter into peace talks is a refreshing change from previous Ethiopian governments and a promising sign that he is committed to reform.

But the deal could have more significant implications for Eritrea, a country that is sometimes referred to as “Africa’s North Korea.” The Eritrean government is a totalitarian regime that has been accused of participating in human rights abuses, including arbitrary detention, torture and religious and ethnic persecution. Many of these injustices are related to its policy of mandatory conscription, which requires all citizens to sign up for national service that often lasts far beyond the mandated 18 months. These conditions have pushed more than 459,000 Eritreans — an estimated 10 percent of the country’s population — to seek asylum around the world. With the end of the “no peace, no war” stalemate with Ethiopia, Eritrea has the opportunity to demilitarize and abolish forced conscription, a move that could open the door to social and political liberalization.

Of course, the agreement is only the beginning of what could be a long peace process. Both sides will need to follow through on their commitments in a timely and comprehensive way. There is already reason for optimism: On Monday, Ethiopia submitted a request to the United Nations to lift sanctions on Eritrea in a show of good faith. The next step will be for Ethiopia to withdraw its troops from the border and particularly the town of Badme. Other African nations should keep a watchful eye on these developments, but for now there is much to celebrate about a peace deal that looked nigh on impossible just a few months ago.