CAIRO — Egypt has released 32 Ethiopian prisoners during a visit by the country's prime minister in which he sought to assure Cairo that a massive upstream Nile dam would not cut into its share of the river, officials said Monday.

Egyptian President Abdel-Fattah el-Sissi pardoned the prisoners, according to Egyptian officials who spoke on condition of anonymity because they were not authorized to brief reporters.

Fitsum Arega, chief of staff to the Ethiopian prime minister, tweeted that the freed prisoners will arrive in Addis Ababa later on Monday. He said Egypt had also promised to help locate the bodies of 38 Ethiopians killed by the Islamic State group in Libya in 2015.

The prisoner release was announced Sunday by Ethiopian Prime Minister Abiy Ahmed at a press conference with el-Sissi.

Ahmed said the soon-to-be-completed Grand Ethiopian Renaissance Dam will not reduce Egypt's share of the Nile, which provides virtually all the Arab country's freshwater. Ethiopia says the dam is essential for its economic development.

Ahmed left Cairo on Monday after a two-day visit, his first since he assumed office in April.