Mozambican President Filipe Nyusi, centre left, and Renamo leader Ossufo Momade hug as they exchange documents, at a signing agreement in Maputo, Mozambique, Tuesday, Aug. 6, 2019. Mozambique’s president and the leader of country’s main opposition group have signed a new peace accord in the capital. By signing the Peace and National Reconciliation Agreement in Maputo Tuesday afternoon, President Filipe Nyusi and Renamo leader Ossufo Momade pledged to end years of armed violence and to peacefully participate in Mozambique’s elections on Oct. 15. (AP Photo/Ferhat Momade)

JOHANNESBURG (AP) — Mozambique's president and the leader of the country's main opposition group signed a new peace accord Tuesday, pledging to end years of violence and facilitate elections in the fall.

In signing the Peace and National Reconciliation Agreement, President Filipe Nyusi and Renamo leader Ossufo Momade said they would peacefully participate in Oct. 15 elections.

Portuguese news agency Lusa said the signing ceremony in Mozambique's capital of Maputo was witnessed by five African heads of state, including South African President Cyril Ramaphosa.

Thousands of Maputo residents also attended the ceremony in Peace Square, including many children wearing T-shirts printed with the phrase "Ultimate Peace."

The European Union's foreign policy chief, Federica Mogherini, and Portuguese Foreign Secretary Teresa Rebeiro were present as well.

Mozambique is a former Portuguese colony that won independence in 1975. Portugal supported the peace negotiations.

The peace accord followed the two leaders signing a related agreement last week to cease military hostilities.

The two agreements are the result of years of negotiations to bring an end to sporadic violence that has persisted since a bloody civil war ended in 1992. An estimated 1 million people died in the 15-year war.

A previous peace agreement was signed in 2014, but the violence sporadically flared up.

The new accords call for the immediate disarmament and reintegration into society of more than 5,000 Renamo rebels. Some Renamo officers are to take up leadership positions in the military.

However, only a few of the rebels have turned in their arms so far.

As part of the negotiations, Mozambique's legislature amended the country's constitution so provincial governors will be elected instead of appointed by the ruling party.

The change is expected to allow Renamo to win a few provincial governorships in the central and northern regions where it has support.

Mozambican President Filipe Nyusi, left, and Renamo leader Ossufo Momade join hands, as they exchange documents, at a signing agreement in Maputo, Mozambique, Tuesday, Aug. 6, 2019. Mozambique’s president and the leader of country’s main opposition group have signed a new peace accord in the capital. By signing the Peace and National Reconciliation Agreement in Maputo Tuesday afternoon, President Filipe Nyusi and Renamo leader Ossufo Momade pledged to end years of armed violence and to peacefully participate in Mozambique’s elections on Oct. 15. (AP Photo/Ferhat Momade)
Former Renamo fighters look on as Mozambique President Filipe Nyusi and Renamo leader Ossufo Momade sign a peace accord at Gorongosa National Park, about 170 kilometres from Beira, Mozambique, Thursday, Aug, 1, 2019.  Mozambique's president signed a permanent peace accord Thursday with the country's main opposition party Renamo to end decades of hostilities that persisted after a devastating 15-year civil war. (AP Photo/Tsvangirayi Mukwazhi)
Women look on as Mozambique President Filipe Nyusi and Renamo leader Ossufo Momade sign a peace accord at Gorongosa National Park, about 170 kilometres from Beira, Mozambique, Thursday, Aug, 1, 2019.  Mozambique's president signed a permanent peace accord Thursday with the country's main opposition party Renamo to end decades of hostilities that persisted after a devastating 15-year civil war(AP Photo/Tsvangirayi Mukwazhi)
Renamo leader Ossufo Momade, center, performs a dance with locals upon his arrival for a peace accord signing ceremony at Gorongosa National Park, about 170 kilometres from Beira, Mozambique, Thursday, Aug, 1, 2019. Momade is set to sign a peace agreement with Mozambique President Filipe Nyusi, ending decades of hostilities that included a 15 year civil war. The former rebel groups remaining fighters are disarming just weeks before a visit by Pope Francis and a national election that will test the now-political rivals new resolve. (AP Photo/Tsvangirayi Mukwazhi)
A woman with her baby waits for Mozambique President Filipe Nyusi and Renamo leader Ossufo Momade to arrive for a peace accord signing ceremony at Gorongosa National Park, about 170 kilometres from Beira, Mozambique, Thursday, Aug, 1, 2019. The peace agreement is set to bring an end to decades of hostilities that included a 15 year civil war. The former rebel groups remaining fighters are disarming just weeks before a visit by Pope Francis and a national election that will test the now-political rivals new resolve. (AP Photo/Tsvangirayi Mukwazhi)