KAMPALA, Uganda — The tears began flowing immediately after Stella Nyanzi began to speak.

It was a cool mid-March afternoon, three weeks after Ms. Nyanzi, a Ugandan scholar and feminist, was released from prison for insulting the country’s longtime president, Yoweri Museveni. Before her was an array of political activists and community organizers, many of whom had traveled long distances to celebrate her newfound freedom at a hotel in Kampala, the capital.

“Thank you for loving me,” she said, drying her tears. “To love me is to invite hate. Some of us have been hated so much that we don’t know how to do love.”

But Ms. Nyanzi, who speaks with a ringing, authoritative voice, quickly got back to her remarks, urging activists in rural and urban areas to work together to build stronger grass-roots coalitions that could challenge the country’s political elite and empower marginalized people.

“We can laugh when we are liberated from Museveni,” she said of the 75-year-old president, once the darling of Western democracy advocates whose rule has devolved into outright autocracy.