Over the past fortnight, Uganda has been convulsed by the fallout from the arrest of opposition MP Robert Kyagulanyi - better known as Afro-beat pop superstar Bobi Wine. His arrest, along with others opposed to the government, led to violent street protests in the capital Kampala and other urban centres.
The current upheavals began in mid-August when President Yoweri Museveni, Bobi Wine, and other opposition MPs descended on the north-western town of Arua to campaign in a by-election.
After several hours of raucous campaigning on all sides, the president's motorcade was attacked with stones as it left the town, allegedly by Bobi Wine's supporters. Museveni reached his helicopter unharmed. But his security detail returned to Arua and unleashed a wave of violence against the crowds still gathered there.
In the ensuing melee Bobi Wine, five other opposition MPs, two journalists and at least 28 other people were arrested. Bobi Wine's driver - Yasiin Kawuma - was shot dead. Over the following days, other opposition figures were also arrested.
Almost immediately after news broke of the arrests and Kawuma's death, street protests erupted in Kampala. These initially centred on the poor neighbourhood of Kamwokya (where Bobi Wine's studio is located) and Kyadondo East (his constituency), but quickly spread. The unrest worsened as news emerged that Bobi Wine and the other arrested MPs had been badly mistreated in custody. When he finally appeared in court 10 days later he could barely walk.
The growing protests drew a sharp response from the security services. The violence left dozens of people hospitalised, and at least two dead. Journalists writing about the affair have been threatened.
The arrest and intimidation of opposition figures isn't new in Museveni's Uganda. Even so, the speed and severity of the security forces' response was shocking. Their initial reaction was bad enough. But the subsequent escalation and the treason case against Bobi Wine suggests there's more to the story than trigger happy soldiers.
And there is. Bobi Wine has been released on bail. This may draw a line under recent events -- for now. But Museveni's problems have only just begun, and run deep. He's facing an increasingly agitated younger voter base, an erosion of the National Resistance Movement's political model, and the growing prominence of social media in Uganda's political life. All these factors will only grow over time.
Changing voter profile
In its first two decades of rule, the National Resistance Movement effectively operated as a single party under the "movement system": all candidates were forced to stand as individuals rather than members of national political parties.
This legacy endures. The "individual" culture of local politics has continued since the National Resistance Movement became a political party in 2005. Its key constituents are rural voters who engage in politics mainly on local issues. They are also old enough to remember the horrific civil war that preceded Museveni's tenure.
To these voters removing the president from power is a perilous, even traumatic idea. Ethnographic research we carried out in southern Uganda during the 2016 presidential election campaigns confirms this. It shows that most of Museveni's voters aren't simply coerced or bought off - they don't want him replaced.
There is little reason to think that the old system is collapsing. Rather the problem for Museveni is that the number of those whose interests and identities it does not cater for is increasing.
This group includes younger voters. They have no memory of the war, have a relatively good education that has led them to want more than the agricultural livelihood of their parents, and stubbornly engage with politics on a national rather than local scale.
They're not interested in replacing a local MP. They want a new president.
These voters have never been a key constituency for Museveni. Previously their political threat could be dismissed - there weren't many of them, they were organisationally weak and concentrated in a few urban centres.
But the ground is shifting under the National Resistance Movement's feet.
Young voters are now scattered across the country, including in the towns of Museveni's rural southern heartland. The advent of social media makes it easier for them to network and communicate with each other. They can also get around more easily.
Most significantly, their numbers are rising fast. Uganda has one of the youngest populations in the world. Just over 48% of its population is 14 years and younger while one in five (21.16%) of the total population are aged between 15 and 24. Only 2% of the population is 65 years or older.
So the 36-year-old Bobi Wine is not a threat because he is saying something that no opposition leader has said before. It's because he has, with considerable skill, positioned himself as a champion of this growing demographic.
Building a movement
Museveni likes to portray his opponents as either divisive tribalists or young hooligans - and worse. Bobi Wine is none of these, as proved by the erudite public letters he traded with Museveni after his 2017 election. He has built a wide platform defined by youth more than ethnicity, class, region or religion.
And, critically, a string of recent by-elections across the country (including Arua) have shown that this brand transcends his local constituency.
It's no coincidence that Bobi Wine's most recent run-in with the law actually happened five weeks earlier during a protest in Kampala against Uganda's controversial new "social media tax" (during which the authorities accused him of inciting a riot).
In the period leading up to the Arua by-election Facebook, Instagram, Twitter, YouTube, and WhatsApp all saw a marked uptick in posts about Bobi Wine and his emerging constituency.
Social media has also played a central role after Arua. Images of Bobi Wine and the other opposition MPs' alleged mistreatment in custody were circulated widely, exacerbating the popular unrest.
It was once possible to discuss opposition to Museveni in regional and ethnic terms. But, increasingly, opposition is a generational story. Whether the enduring face of this new politics is Bobi Wine or someone else, Ugandan politics is clearly changing.