ADDIS ABABA, Ethi­o­pia — Eritrean President Isaias Afwerki landed in Ethiopia’s capital Saturday morning, following his Ethiopian counterpart’s groundbreaking trip to Asmara this month amid the warming ties between the once-rival nations.

After a two-year war and an 18-year standoff, the two countries have suddenly agreed to restore diplomatic ties, end the state of war and reestablish long-severed transportation links in the wake of overtures last month by Ethiopian Prime Minister Abiy Ahmed.

In a sign of the two countries’ new coordination, the visit was announced on Twitter at nearly the same time and the streets of Addis Ababa were festooned with Eritrean and Ethio­pian flags, side by side.

Isaias was welcomed at the airport in Addis Ababa by a military marching band and traditional dancers, as Abiy had been in the Eritrean capital. Well-wishers lined Addis Ababa’s streets, waving both countries’ flags and chanting antiwar slogans. Eritrean state television superimposed the flags onto images of doves of peace.

The two leaders signed a five-point peace agreement on Monday, and now roads will be reopened, telephone connections have been restored, and, on Wednesday, Ethiopian Airlines will have its first flight to Asmara in 20 years.

After the decades of hostility, Ethiopia’s deputy prime minister, Demeke Mekonnen, said the time was right for peace.

“Now I am an optimist. All of us have learned a lot, and I think he [Isaias] is also very much committed to going all the way,” he told The Washington Post in an interview. “We have paid a lot, both of us.”

Eritrea fought for its independence from Ethiopia for 30 years, with Isaias serving as a leader of the Eritrean People’s Liberation Front (EPLF) before becoming president after its 1993 independence.

After the downfall of Ethiopia’s communist-led government, the leaders of newly born Eritrea and Ethiopia fell out in the 1990s over the border demarcation and economic issues such as currency.

Despite the recent rapid improvement in relations, delicate negotiations lie ahead over those same issues that lay at the base of the original break. “In such conditions, it is better to start with the simplest ones,” said Demeke, explaining that the border and the economy would be tackled later.

The breakthrough in relations appeared to come when Abiy on June 5 agreed to implement the 2002 arbitration agreement that ended the war and awarded key border territories to Eritrea such as the town of Badme. Two weeks later, Isaias responded favorably, and relations took off.

However, according to Kjetil Tronvoll, an expert on the conflict from Oslo’s Bjorknes University College, it may have been more about Abiy himself, rather than his offer.

The conflict between the two countries was in some ways a personal one between Isaias and Meles Zenawi, a former prime minister of Ethiopia who died in 2012. Abiy’s rise in power has been accompanied by the marginalization of Meles’s once-dominant faction of the ruling party, called the Tigrayan People’s Liberation Front, which made the Ethiopian government more palatable to Isaias, Tronvoll explained.

“Basically, in the mind-set of Isaias and EPLF, he won the war, he got Badme, and TPLF has ‘lost power’ in Ethiopia,” he said. “Isaias is the ‘last man standing’ — and he proved them all that his strategy was the correct one.”

In his speech accepting Abiy’s overture, Isaias exulted over what he saw as the Ethiopian people’s rejection of the TPLF.

“But although it will require time and efforts to remove the TPLF’s toxic and malignant legacy and to bring about a congenial climate, the positive direction that has been set in motion is crystal clear,” he said. “The TPLF clique and other vultures are dumbfounded by the ongoing changes.”

The TPLF initially responded with apparent annoyance at Abiy’s overtures, insisting that it had to be involved in any peace agreement with Eritrea, but it subsequently issued a statement supporting the agreement signed in Asmara.

A normalization between the two countries will be a major boon for both, especially in cross-border trade. It also solves Ethiopia’s perennial problem of access to the Red Sea, from which it was cut off after Eritrea’s independence.

Currently, 95 percent of Ethiopia’s foreign trade goes through the port in neighboring Djibouti, with all sorts of bottlenecks in port capacity as well as transportation links.

Since coming to power, Abiy has signed a number of agreements with neighboring Somalia, Somaliland, Kenya and Sudan to diversify port access for the export-based industrial economy Ethiopia hopes to one day become.

Eritrea’s ports of Massawa and Assab are well placed to be the gateway for Ethiopia’s future exports.

Ethiopia has also asked that the U.N. sanctions it helped put in place against Eritrea for its alleged support of the Somali Islamist movement be lifted.

During the beginning of his term, Isaias was seen as an inspirational figure in Africa, shunning the cult of personality common elsewhere on the continent. He was named by President Bill Clinton during his 1998 African tour as one of the leaders of the African renaissance.

In the wake of the war with Ethiopia and following criticism of his handling of it, however, Isaias purged many of the top figures in the ruling party, shut down the press and suspended many of the democratic provisions in the constitution.

Reporters Without Borders routinely ranks the press freedom there as worst in the world, below North Korea. A 2015 U.N. report said “systematic, widespread and gross human rights violations have been and are being committed in Eritrea” and that “some of these violations may constitute crimes against humanity.”

Bearak reported from Nairobi.