A prominent academic has been jailed for 18 months for criticising the Ugandan president Yoweri Museveni in a graphic Facebook post about his 33-year rule.

Stella Nyanzi, a feminist, activist and university lecturer, bared her breast in protest at the sentence for cyberharassment while appearing in court by video link from a maximum security prison.

Human rights groups condemned the conviction as an “outrageous” attack on freedom of expression and accused the government of using laws about electronic communications to stifle political dissent.

“Stella Nyanzi has been criminalised solely for her creative flair of using metaphors and what may be considered insulting language to criticise President Museveni’s leadership,” said Joan Nyanyuki, director for East Africa at Amnesty International.

“The mere fact that forms of expression are considered insulting to a public figure is not sufficient ground to penalise anyone. Public officials, including those exercising the highest political authority, are legitimately subject to criticism and political opposition.”

Ms Nyanzi, who has previously called the president a “pair of buttocks”, was arrested and detained in prison on 2 November last year, two weeks after she posting a birthday poem for the president.

After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda Show all 8 1 /8 After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412186.jpg After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412170.jpg Getty Images After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412171.jpg After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412169.jpg Getty Images After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 3303966.jpg Getty Images After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412163.jpg After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412164.jpg After the exodus: 40 years on from Amin's terror offensive against Asians in Uganda 5412162.jpg

Referring to Mr Museveni’s mother Esiteri, she wrote: “I wish the acidic pus flooding Esiteri’s vaginal canal had burn up your unborn foetus. Burn you up as badly as you have corroded all morality and professionalism out of our public institutions in Uganda.”

She suffered a miscarriage while in prison and in February the University of Makerere terminated her employment as a research fellow at the Institute for Social Research.

In her most recent Facebook post about the court case, she wrote: “My presence in your court as a suspect and prisoner highlights multiple facets of dictatorship. I exposed the entrenchment of autocracy ... I refuse to be a mere spectator in the struggle to oust the worst dictator.”

The offence of cyberharassment carried a maximum sentence of three years’ imprisonment or a fine of 1.4 million shillings (£311).

Following the conviction, Amnesty called for Ms Nyanzi, who has already spent nine months in prison, to be freed immediately.

“This verdict is outrageous and flies in the face of Uganda’s obligations to uphold the right to freedom of expression for all people in Uganda and demonstrates the depths of the government’s intolerance of criticism,” said Ms Nyanuki.

“It must be quashed and Stella Nyanzi, who has already suffered enormously for expressing her opinions, left to get on with her life.

“The Ugandan authorities must scrap the Computer Misuse Act 2011 which has been used systematically to harass, intimidate and stifle government critics like Stella Nyanzi.”

Ms Nyanzi’s campaigns on issues such as demanding sanitary pads for schoolgirls and gay rights have made her a divisive figure in a country where homosexual acts are illegal. Her most recent criticism of the government has focused on its tax on social media.