Mali's military junta whipped up nationalist sentiments as it successfully pushed West African leaders to end the economic blockade imposed on the country following a coup, writes regional analyst Paul Melly.
In return for setting a firm February 2024 election deadline, Mali's regime has secured an end to the sanctions imposed by the Economic Community of West African States (Ecowas).
For ordinary Malians, particularly the urban population in the capital, Bamako, who consume more imported goods, the lifting of the sanctions is certainly good news.
Although the measures were not meant to curb the supply of basic essentials, in practice they were an additional pressure for traders and families already struggling to cope with the rise in world grain and fuel prices driven by the resurgence of world demand after the pandemic and then the Russian attack on Ukraine.
The sanctions were imposed in January after the junta, which seized power last year, announced a four-year delay in the transition to elected civilian rule. It has now pruned back the transition to less than two years, with elections starting in February 2024.
This was accepted by Ecowas leaders at their summit meeting in Ghana's capital, Accra, at the weekend.
It is a significant success for Mali's regime, but also a huge relief for Ecowas, which has increasingly come to be viewed by many Malians, and many others across the region, as an over-weaning club of presidents who take a harsh line against military putschists but overlook their own faults.
Mali's military leaders and Prime Minister Choguel Maïga cleverly played on these popular perceptions to present themselves as the defenders of the people against bullying neighbours, who failed to appreciate the need for radical change in a country whose traditional elite had supposedly been rotted by corruption and complacency.
Over the past six months, every tough message from Ecowas or Europe and the United Nations, has been met with a defiant nationalist response from Bamako.
In mid-May the regime announced that Mali was quitting the G5 Sahel bloc, created in 2014 to coordinate a joint effort by Sahelian armies in fighting jihadist groups.
The regime has maintained its collaboration with the Russian security contractor Wagner, despite allegations from Human Rights Watch and others about widespread abuses against civilians.
The breakdown of its relations led France and other European countries to announce the withdrawal of the troops they had deployed to fight jihadist groups, a process that will be complete with the departure of the final contingent from the French force Barkhane next month.
Meanwhile, the Bamako regime has imposed ever-tighter restrictions on the operations of the UN peacekeeping force known by its acronym Minusma, denying its investigators local access to investigate reported crimes, such as the army and Wagner's alleged killing of around 300 people in the village of Moura in late March.
Yet even as Mali became more defiant, it gradually reined back its political agenda, edging towards something that Ecowas might accept.
Spate of coups
West African leaders were initially ready to show some flexibility. Their envoy for the Mali crisis, former Nigerian President Goodluck Jonathan, kept up his shuttle diplomacy visits to Bamako.
However, Ecowas felt it had to hold the line against the accelerating wave of military coups across a region that until recently could pride itself on being mostly ruled by governments elected in genuine multi-party systems.
The August 2020 coup in Mali was followed by a second putsch in May last year. Then in Guinea in September Colonel Mamady Doumbouya overthrew the increasingly autocratic President Alpha Condé.
And in Burkina Faso in January this year military officers ousted President Roch Marc Christian Kaboré - who had been elected to a second term in a genuinely democratic contest only 14 months earlier - amid anger at his failure to curb the spread of jihadist violence.
Then February saw what appeared to be a failed coup attempt in Guinea-Bissau. Eleven people died as soldiers loyal to President Umaro Sissoco Umbaló successfully fought off soldiers who attacked the government headquarters.
And there has been speculation that other countries in the region could also see military takeovers. So Ecowas certainly needed to deter potential putschists.
Yet at the same time its leaders have been desperate to find a way that would bring Mali, as well as Guinea and Burkina Faso, back into the club of countries that are governed by elected civilians, under proper constitutional rule.
And that has been important not just for the sake of West African democracy but also because Mali sits right at the heart of the Sahel crisis and the struggle to contain the spread of militant violence and inter-communal tensions.
Regional collaboration in tackling other pressures such as food insecurity and climate change could only be hobbled by the country's deepening isolation.
Retreat from confrontation
Step by step, the regime in Bamako took measures that have helped to reassure Ecowas leaders - the passage of a new electoral law and arrangements for an elections authority, and a detailed roadmap for the transition, and, above all, a fixed timetable that sets a firm deadline for the first round of the presidential election to take place in February 2024.
There still appears to be uncertainty over whether the new arrangements will deny the junta leader, Assimi Goïta, the right to stand in that election.
But Ecowas appears to have decided to "bank" the commitments that it could secure at this stage and remain in dialogue with the Malian leadership over the remaining details.
West African leaders concluded that this is sufficient to justify the lifting of sanctions. And for them, there is a further big plus point.
This compromise deal opens the path to a gradual retreat from the damaging confrontation with a defensively nationalist Bamako regime and a gradual restoration of the normal cooperative relationships between Mali and its neighbours - so badly needed as the region struggles to tackle to the Sahel crisis.
And in that same vein, Ecowas has also managed to reach agreement with Burkina Faso's military junta on a timetable for a transition back to democracy, with a return to civilian rule in July 2024.
Ecowas hopes these precedents will encourage the Guinean military regime to follow suit. It has chosen Benin's former President Thomas Boni Yayi as its mediator, to try to negotiate a deal with the regime in Conakry.
Paul Melly is a consulting fellow with the Africa Programme at Chatham House in London.