In Kenya, President Uhuru Kenyatta finally secured a second term on Nov. 28 after two flawed elections, outbreaks of violence, and a series of court battles.
Across the continent in Liberia, the former soccer star George Weah won a presidential election after a similar court battle had delayed that country's first peaceful democratic transfer of power since 1944.
And in Zimbabwe, President Robert Mugabe was finally deposed last year after 37 years in power -- only to be replaced by Emmerson Mnangagwa, a ruthless former national security minister responsible for some of the regime's bloodiest excesses.
It has been a dizzying few months, but two important but contradictory trends have emerged. The first is the deepening of a democratic recession, made evident by the recent assault on presidential term limits in places such as Rwanda and Uganda.
This process has been driven by elites' development of new and subtle forms of political and electoral manipulation -- including the use of counterterrorism laws, financial aid from Western nations, and geopolitical arm-wrestling over resources with China -- to stymie the political opposition and entrench the power of ruling elites.
The second trend is the continuing resilience of political optimism among African voters, especially the youth, who overwhelmingly support democracy. Young people made up the bulk of demonstrators who battled with police in recent months from Togo and the Democratic Republic of the Congo to Kenya and Zambia.
Their optimism has been buoyed in part by the rise of an aggressively independent media, the maturing of institutions such as the judiciary, and by the explosion of nongovernmental organisations fighting to hold governments accountable despite increasingly restrictive conditions.
Indeed, a massive generational struggle is now underway between entrenched elites and impatient youthful populations across the continent. In several countries, institutions that were once firmly under the thumb of elites are showing glimmers of independence -- from the media (including social media) to the church and the judiciary.
Never in Africa's independent history has such a broad alliance stood for democracy against elites with deep financial and security ties to powerful countries in the wider world.
The question now is whether this grassroots democratic consolidation, exemplified by the massive anti-Mugabe protests and the armies of lawyers and human rights campaigners fighting for transparency in Kenya, can check or begin to reverse the tide of authoritarianism being unleashed by elites from above.
In the long term, demographic shifts make democratic change seem inevitable. Africa's population is the youngest, fastest growing, and, in many places, the most rapidly urbanising on the planet. The individuals driving this youth bulge are increasingly globalised in their aspirations, more digitally savvy than preceding generations, and far more impatient with the authoritarian leaders their parents long ago learned to tolerate.
But change won't happen overnight. Political transitions in Africa have always been fraught affairs. It was far worse in the first three decades after most sub-Saharan African countries gained independence in the 1960s, when civil wars raged across much of the continent and coups were all too common.
Since then, losing an election or handing over power because of constitutional term or age limits has become less of a novelty, even if the Sudanese telecoms billionaire Mo Ibrahim has found few deserving recipients for his $5 million prize for democratically elected heads of state who step down on time and with a relatively clean slate. (Since the annual Ibrahim Prize for Achievement in African Leadership was created in 2006, it has been awarded only five times.)
In the 1990s, after the fall of the Berlin Wall heralded the reintroduction of multiparty politics across the continent, 48 new constitutions were promulgated in Africa. Thirty-three of them included term limits for heads of state -- most of them two five-year terms. But by 2015, a dramatic reversal was underway.
In at least 24 of the 33 countries with term limits, attempts were made to remove them -- half of them successful, as was the case in Uganda, Rwanda, and Burundi. Elsewhere, authoritarian leaders clung to power through other means -- by delaying elections indefinitely, as President Joseph Kabila has done in Congo, or by rigging them cleverly enough to pass the muster of international observers, as Kenyatta has done in Kenya.
Aiding and abetting this trend toward authoritarianism were Western countries worried about the spread of Islamic extremism in Africa. The United States in particular has lavished military and counterterrorism aid on African governments with little regard for their democratic credentials -- so long as they were willing to fight jihadis.
In many cases, these governments grew more repressive, using anti-terrorism legislation and other legal and extralegal instruments to cow the opposition and silence dissenting voices while U.S. security assistance continued to flow.
Niger experienced an erosion of political rights between 2015 and 2017, according to Freedom House, while its government deepened military cooperation with the United States. Other important U.S. allies, such as Ethiopia, Uganda, Cameroon, and Chad, have experienced democratic backsliding or were authoritarian, to begin with.
Kenya's story is particularly disappointing. It has been one of America's most important counterterrorism partners in the troubled Horn of Africa region and also had the dubious distinction of leading the continent in extrajudicial killings by the police in 2016, according to Amnesty International.
Abuses by the security forces marred the most recent election campaign as well, with more than 60 Kenyans killed by the police between the Aug. 8, 2017, election and the court-ordered rerun in October. None of these murders has been successfully investigated, and Kenyatta later praised the police for their actions during the election period.
There have also been attacks on organizations promoting human rights and good governance, many of which sought relief from the courts, which were themselves under attack by Kenyatta.
Last September, Chief Justice David Maraga was forced to make a rare statement pleading for the security of his judges after the president threatened to "deal with" the judiciary, and on the eve of the election rerun, the bodyguard of the deputy chief justice was shot in broad daylight in an apparent assassination attempt.
Kenyatta's subsequent victory came amid an opposition boycott and 39 percent turnout -- the lowest in decades. For the first time in 50 years, Kenyans boycotted the country's Independence Day celebrations on Dec. 12, forcing the president to address a near-empty stadium.
As leaders have rolled back democratic gains, the attitudes of ordinary Africans toward democracy and its accompanying freedoms remain robust. According to a 2016 Afrobarometer poll, 67 percent of Africans prefer democracy to other forms of government.
Meanwhile, the independent media continues to blossom across the continent; whereas in the 1980s there were only a handful of countries with a free press, the media in Botswana, Ghana, South Africa, Cape Verde, Comoros, Burkina Faso, Niger, Lesotho, Kenya, Ivory Coast, and a number of other countries have become an essential part of the democratic infrastructure. Organisations that didn't exist two decades ago have come to play a similar role in ensuring political accountability.
And although Kenya's recent elections were deeply flawed, the government didn't dare choke off the internet or shut down social media, as more authoritarian regimes such as Ethiopia's and Uganda's have done in recent years. That's because Kenya's oligarch class -- unlike in many other countries in the region -- comprises businesspeople, not soldiers.
The internet and financial technology are essential to the country's vibrant and increasingly globalised economy.
Across the continent, the trend at the grassroots level is toward more democracy, not less. Authoritarian leaders are still clinging desperately to power, and in the short term, they may well succeed in halting or reversing democratic strides.
But the younger, more impatient generation now coming of age has corrupt, authoritarian elites squarely in its sights. In Zimbabwe, Mugabe's resignation is merely the beginning of the next chapter in the country's democratic journey -- one that will pit the pro-democratic youth against the corrupt old guard.
Democracy is messy, and the next phase of this generational contest will be messy, too. But Africa's youth are redefining the rules of political engagement and will determine the continent's future.