Demobilising ex-combatants as part of a peace deal is hard to do at the best of times. But increasingly - from Kenya to Somalia - it's being tried in the middle of ongoing anti-insurgency conflicts, which adds a whole new level of complication.
Disarmament, demobilisation, and reintegration - DDR as it's known - is about reducing the risk of violence reigniting by incentivising peace. A stake in the system is seen as the glue to hold post-conflict deals together.
But reality is often messier. Reintegration is hard, especially when economies are dominated by informal business. The vocational training typically offered churns out thousands of carpenters, when cash and therapy seems a better bet.
Former communities have often been displaced, fragmented, and traumatised by conflict, making reinsertion all the harder.
But increasingly DDR is being employed when there's no peace to keep. It's seen as a useful component in countering violent extremism (CVE) programming, which prioritises conventional development goals rather than the drones and special forces more often associated with the "war on terror".
As such, DDR is now more political than it's ever been. Amnesty schemes and the promise of grants and support to surrendering fighters are used as a way to thin opponents' ranks just as much as regular military operations.
There are other concerns. What is the legal framework to distinguish DDR from plain detention? What are the qualification criteria and human rights safeguards? More broadly still are basic questions over "whether or not the necessary doctrine, resources, finances, and partnerships are in place to deliver effective programming," researchers James Cockayne and Siobhan O'Neil note.
A home-grown initiative
Regardless of the challenges, the Sahelian country of Niger is giving it a go. Since 2015 it has suffered attacks from the jihadist group Boko Haram, effortlessly crossing the border with its giant southern neighbour Nigeria to raid and recruit.
In December last year, the government of Niger launched a deradicalisation and reintegration programme for Boko Haram fighters who quit the battlefield. "We will guarantee them security. We will avoid imprisonment," Interior Minister Mohamed Bazoun said when he announced the initiative in the southern town of Diffa. "We will instruct them and teach them a number of activities."
This home-grown initiative has been enthusiastically taken up by Diffa Governor Mahaman Lawaly Dan Dano, who has enlisted the University of Diffa to provide advice and help build community buy-in for "the repantis", or "the repentant", as they are known.
Currently, more than 150 people are in the programme, including fighters' "wives" and 28 young boys. They were originally kept in Diffa town, but conditions were so poor there was an escape attempt and the group has since been moved west to Goudoumaria, a two-hour drive away, to a camp originally built for refugees.
Their circumstances are now a good deal better. There is water. They are fed regularly, and they even have a small infirmary. But there is not yet any psychosocial support, vocational training, nor are there any schools for the children.
"The main problem is boredom," said the head of the UN children's fund (UNICEF), Viviane Van Steirteghem, who recently visited the camp.
Much yet to do
"The programme is not definitively built," explained Boukari Kassoum, head of the Peace and Development Unit at the University of Diffa. "But it's good that it has begun."
Steirteghem said 12 fully equipped EU-funded vocational training centres will be built in each of Diffa's municipalities, an investment in a deprived region where the first schools didn't arrive until the late 1990s.
A related DDR programme involves the gradual release of some 80 minors captured on both sides of the border and held in detention in the capital, Niamey. They're being returned to so-called "transit and orientation centres" in Diffa, from where they're being returned to their families, with periodic checks made by the authorities.
Steirteghem was guarded over providing further details. "For Niger, this is all relatively new, and extremely sensitive," she told IRIN.
Part of the problem revolves around community acceptance.
Rado Moustapha is the mayor of Goudoumaria, a man you would expect to have a degree of engagement with the deradicalisation programme. But when IRIN visited, he stressed that he was yet to pay a call on the repantis camp, just six kilometres out of town. He clearly regarded the initiative as driven by the ministry of internal affairs and foisted upon Goudoumaria from above.
"I don't know what advantage we will get from it," he told IRIN. For Moustapha, Boko Haram are simply killers. "We don't know what they want - they just slaughter. It's the wrong interpretation of Islam. It's like a revolution by people not brought up correctly who didn't listen to their parents."
Niger versus Nigeria
Southeastern Niger is a Kanuri region, the same ethnic group that in Nigeria form the bulk of Boko Haram. Before the insurgency began in 2009, Mohamed Yusuf, the founder of the group, and his successor, Abubaker Shekau, were familiar figures in Diffa.
But nobody IRIN spoke to believed that affinity for Boko Haram's ideological message - the rejection of Westernisation - amounted to any real reason for recruitment.
Niger is a conservative Islamic country. According to a 2013 Afrobarometer survey, 67 percent of Nigeriens would like to see Sharia adopted in the constitution. But that is a reflection of a yearning for a more just society, an Overseas Development Institute study found.
Multiparty democracy is not rejected: at issue is the system's failings, its seeming privileging of the rich and disempowerment of the poor in Niger.
Akasser al-Fazaz of the NGO SOS-Civisme-Niger is adamant that the factors that have encouraged violent extremism in Nigeria are absent in Niger.
"Political authority in Nigeria is ineffective," he said. "Nigeria is a federation, but Niger is a unitary state and can respond quickly [to threats]. We have laws that forbid hate speech, and the media is regulated."
The motivation, therefore, behind Nigerien youth joining Boko Haram is seen almost exclusively as economic. Diffa is a marginalised region, made poorer still by drought in 2010 and 2011, followed by flooding in 2012 and 2013 that hit the main cash crop: bell peppers. Insecurity has reduced production still further.
"The perception is that people went looking for money," said Kassoum of the University of Diffa. The youth that joined Boko Haram came back with booty, encouraging others to join. Boko Haram then shut the door "and didn't allow anybody back", except as gunmen ready to fight.
The government's counter-insurgency strategy has been a heavy burden. It has cleared communities from the islands in Lake Chad and along the Komadugu Gana River, the border with Nigeria, adding to the toll of 157,000 displaced people.
Aboubaker Issa, a youth leader in Diffa, believes priorities are back to front when it comes to the repantis.
"First, the government should meet those communities that lost everything, living under trees: Meet those people, comfort them, and bring them back to their houses, give them means to resettle," he told IRIN. "After that, the government can turn to the ex-combatants and help them come back to their communities."
Beyond vocational training, it's real jobs people want.
The needs are so dire, "that if the government persists to say that it will integrate Boko Haram members, there isn't a youth that will stay here," said Issa. "They will all join [to benefit from the reintegration package]."
The model that Diffa youth have in mind is the peace deal struck between the government and Tuareg rebels in the north that ended a 2007-2008 insurgency. In response to Tuareg demands for greater inclusion, jobs were provided to ex-fighters.
For Steirteghem, the circumstances of a peace deal and orthodox DDR are very different from the current situation - where an entire region needs support.
"We are attempting to ensure that there is some kind of equity in opportunity provided to the youth - for those coming back from Boko Haram and the youth that stayed and didn't go."
With additional reporting from Aboubacar Sidi
This is one of a series of features on violent extremism in Nigeria and Sahelian Africa, part of a project with the Open Society Initiative for West Africa (OSIWA)