(CNN) -- Rebels in the Central African Republic -- who took over numerous towns and threatened to overrun the capital -- will be part of a unity government under that nation's embattled president, a government spokesman said Friday.
The apparent deal would appear to end violence that began last month, when the Seleka rebel coalition launched an offensive as they demanded President Francois Bozize step down after accusing him of reneging on a peace deal.
As the insurgency advanced in the nation's north and neared the capital of Bangui, Bozize urged the international community, including the United States and France, to help fend off the rebellion. He also engaged in peace negotiations, including those this week involving the Seleka and opposition party leaders in Gabon's capital, Libreville.
These talks ended Friday with an agreement to form a "government of national unity" headed by Bozize, said Jules Gauthier Ngbapo, a spokesman for the Central African Republic's decentralization and territorial administration ministry.
"Seleka rebels and ... opposition (party) leaders agreed to select the prime minister," said Ngbapo, who added that there will be new legislative elections in a year.
Bozize, the soon-to-be named prime minister and Cabinet members cannot run in the next election, said Margaret Vogt, a special representative of the U.N. secretary-general.
The rebels want 400 South African troops deployed to the Central African Republic to "withdraw progressively," Ngbapo said. South African President Jacob Zuma announced Sunday that his nation's troops would "assist with capacity building" of the Central African Republic's military, which was then fighting a still vibrant insurgency.
The new government and the other changes were expected imminently. A cease-fire -- expanding on one that Ngbapo, earlier Friday, said would be in effect for a week -- goes into effect "within 72 hours" of the parties signing the deal, said Vogt.
"We are hopeful that the agreements that have been signed today in Libreville will contain the immediate flare-up and will calm the situation ... and enable us to recalibrate the disarmament process," Vogt said from New York, where the United Nations is based.
At the same time, the U.N. official warned the lack of introspection -- and corrective action -- regarding why past agreements weren't fully implemented "may lead to another meltdown a few years down the line."
This sentiment was echoed by the office of European Union foreign affairs representative Catherine Ashton.
"Such an agreement is the first step out of the crisis," Ashton's office said. "To be sustainable, the normalization and stabilization of the country in the longer term requires the underlying causes of the outbreak of recurrent conflicts in the Central African Republic to be addressed in a consensual way by all stakeholders."
The deal comes after fits and starts in the peace process in recent weeks, which were marked by fighting interspersed by indications both sides were open to dialogue.
For instance, Ngbapo said rebel fighters attacked two towns last Saturday -- a few days before their leaders were set to join Bozize, as well as the presidents of Gabon, Chad, Equatorial Guinea, Guinea and the Republic of Congo, in Libreville. CNN was unable to confirm government claims about the occupation of the towns.
As the government scrambled to put down the rebellion, UNICEF representative Souleymane Diabate said "reliable sources" had told his U.N. agency "that children are newly being recruited" by rebel groups and pro-government militias.
Armed groups were forcing people younger than 18 to fight, carry supplies and serve as sex slaves, the agency said last Friday.
About 300,000 children have been affected by the rebellion, including family separation, sexual violence, displacement and lack of access to education and health facilities, the agency said.
CNN's Karen Smith contributed to this report.