A Ugandan feminist and activist reacted with fury and defiance after being sentenced to nine more months in prison for publishing a metaphorical poem about the birth of President Yoweri Museveni and his mother’s vagina.

Stella Nyanzi was found guilty of “cyber harassment” on Thursday and sentenced on Friday for posting a Facebook poem using graphic imagery as a metaphor for Museveni’s “oppression, suppression and repression” over 33 years of rule.

She was given an 18-month sentence but has already served nine months in Luzira Women’s Prison after publishing the verse that magistrate Gladys Kamasanyu said should never have been put in the public domain, describing it as “obscene” and “indecent” including suggestions which “could only be made by an immoral person.”

The final ruling of the case took place on Thursday and Friday at Buganda Road Chief Magistrate Court.

On Friday, Nyanzi only appeared in court on a television screen although she was in the court building and her shouting could be heard from the courtroom.

Furious at not being permitted to physically attend the final judgement, the activist repeatedly shouted “f*** you, f*** you,” put both her middle fingers up, and flashed her breasts. Nyanzi has stripped as a form of protest in the past, and this along with her use of graphic language is described by some commentators as “radical rudeness.”

The academic was also charged with “offensive communication,” but found innocent on that count.

The ruling took place following an unsuccessful revision of the case at Uganda’s High Court earlier in the week.

Nyanzi’s team applied for the revision on nine grounds, including that the lower court “acted illegally, irregularly and improperly when it closed the accused person’s case without affording her the mandatory or necessary facilities to call any evidence.”

Nyanzi’s lawyers did not attend court on Thursday or Friday, enabling the activist to speak for herself in response to the state prosecutor’s statement.

“I planned to offend Yoweri Museveni Kaguta, because he has offended us for 30-plus years,” said Nyanzi on Thursday, who explained that she was disappointed not to be found guilty of offending the President “because that is what serious mothers in Uganda should be doing”.

A line from a poem posted by Stella Nyanzi’s Facebook account on Thursday reads: “I never came to your Court seeking for justice. I came to your Court to play the game of politics.”

Nyanzi’s courtroom speech on Thursday also included a focus on conditions for women in prison, and sacrificing her role as mother to her three children in order to “speak truth to power.”

About 130 members of the public crowded into court on both days, some dressed in blue Stella Nyanzi T-shirts representing opposition party the Forum for Democratic Change (FDC) and others wearing red “people power” berets — the hats worn by supporters of Bobi Wine, a musician turned opposition politician in Uganda.

Heavy police deployment did not stop Nyanzi’s allies from singing and chanting, and one woman vowed to “sing the Ugandan national anthem until we have justice.” While Nyanzi was making her statement on Thursday, the courtroom shouted “people power” and the academic herself led a chant of “viva opposition.”

As the magistrate read out the academic’s final sentence on Friday, her voice could barely be heard among shouts from Nyanzi’s supporters. While some walked out of the courtroom as they heard the sentence, others continued to shout and chant.

The ruling ended in unrest, as a plastic bottle was thrown at the magistrate and police officers clashed with spectators in the courtroom which was then evacuated.

Speaking to the media after the incident, FDC politician and Nyanzi ally Ingrid Turinawe explained that when people saw Nyanzi on the television screen she “was quarrelling, she was protesting, she was crying, and that caused a lot of anger within the people who support her.”

Turinawe added that members of the opposition party in the courtroom had been arrested.

Kampala Metropolitan Police Spokesperson Patrick Onyango told CNN six people were arrested on charges of assault, malicious damage and contempt of court.

They are an “unruly and undisciplined group of people,” he added.