Mozambique's government and the ex-rebel group Renamo completed a long-awaited peace pact on Tuesday, inking a final deal aimed at ending years of conflict.
The deal was signed by President Filipe Nyusi and Renamo leader Ossufo Momade in Maputo's Peace Square and witnessed by former presidents and regional and continental leaders.
Thousands of people applauded as the two leaders showed the signed document, named the Maputo Peace and Reconciliation Agreement, an AFP correspondent said.
The pact brought the curtain down on marathon negotiations initiated by Afonso Dhlakama, the historic leader of the Mozambique National Resistance (Renamo), who died in May last year.
The UN's special envoy on Mozambique, Mirko Manzoni, said it was a "truly historic day."
"This agreement will bring ultimate peace in a country that has seen enough suffering," he declared.
The deal comes just two months before general elections on October 15 that the ruling Frelimo party, the dominant political force for more than four decades, is expected to win.
Renamo, founded as an anti-communist guerrilla group, unleashed a civil war against the Marxist Frelimo government shortly after independence from Portugal in 1975.
The brutal fighting -- seen by many historians as a proxy conflict between East and West during the Cold War -- lasted 16 years.
Around million people died, many of them in a famine in 1984-5, and the country was devastated economically and left littered with landmines.
The war ended when the Soviet Union and apartheid-era South Africa scaled back their respective support for Frelimo and Renamo, leading to direct peace talks.
The rebel movement then entered politics after a 1992 peace pact which was signed in Rome, paving the way for multi-party elections in 1994.
Renamo lost that vote and subsequent elections and became the official opposition party, although it retained an armed wing.
But in October 2013, Renamo renounced the 1992 peace deal after the military raided its bush camp in central Sathundjira.
Clashes erupted again between government forces and Renamo soldiers, lasting until 2016.
On August 1, the two rivals signed a precursor accord in Gorongosa National Park under which they formally agreed to end military hostilities.
"This agreement will be successful because it is peace made by Mozambicans and for Mozambicans. A break with the past," said Manzoni.
Among the leaders who attended Tuesday's ceremony was President Cyril Ramaphosa of the neighbouring economic powerhouse of South Africa and President Paul Kagame of Rwanda.
"The signing of this agreement will pave way for peaceful elections," Ramaphosa said.
Portugal, the former colonial power, expressed "deep satisfaction... (at) the new chapter opening today."
"This agreement, the result of a long negotiation process, represents fundamental progress in building peace," the foreign ministry said in Lisbon.
Last week Renamo began disarming armed members as part of the peace deal.
Some of the demobilised fighters will be absorbed into Mozambique's army and police, while others will be reintegrated into civilian life.
More than 5,200 Renamo fighters are expected to surrender their weapons to the government.
But the party is suffering internal divisions.
A small group of disgruntled members is vowing not to turn in their arms and refusing to recognise the new leader Momade, who has already been nominated as Renamo's presidential candidate for the October elections.
Nyusi warned last week that any Renamo fighters who chose not to hand in their weapons under the ongoing disarmament programme would be "hunted down".
Tuesday's signing also comes as Nyusi's government is battling a jihadist insurgency in the north that has claimed more than 250 lives since October 2017.