A court in Bahrain has convicted political activist Nabeel Rajab and sentenced him to five years in prison, for his comments online denouncing Saudi Arabia's role in the war in Yemen and for criticising prison abuse in his country.

The Bahrain Center for Human Rights said Rajab was convicted on Wednesday for "disseminating false rumours in time of war", for "offending a foreign country" and for "insulting a statutory body" as codified in the Bahraini criminal code.

Rajab's charges include a social media post on March 26, 2015, the day Saudi Arabia launched an invasion of Yemen. His post criticised wars that "bring hatred, destruction and horrors".

In a statement, Dimitris Christopoulous, president of the International Federation for Human Rights (IFHR), said the "outrageous sentence" on Wednesday "contributes to further shut down" the space for civil society and peaceful protest in Bahrain.

"Nabeel Rajab is not a criminal, he is a prominent human rights defender and political prisoner," Christopoulos said.

He and his organisation called on the Bahraini government to "immediately release" Rajab and other human rights activists in detention.

The World Organisation Against Torture also weighed in, calling Rajab's trial "a mockery of justice" and his verdict as "surrealistic.

"This continuous harassment, which illustrates, once more, the government's relentless efforts to silence the whole Bahraini civil society, must stop," Gerald Staberock, the organisation's secretary-general, said.

Since June 2016, Rajab has been in "solitary detention" despite his health conditions, according to the Bahrain Center for Human Rights.

The human rights watchdog noted that Rajab's trial had been postponed 20 times, and that the government violated court procedures by failing to give his lawyers enough opportunity to defend their client.

The group also alleged that Rajab had been beaten and subjected to "humiliating and degrading" condition while in detention.

Today #Bahrain issued a 2nd shameful verdict! The Military Court upheld on appeal the death sentence against 4 men. Call for their convictions to be quashed; their case to be moved to an ordinary court; exclude evidence obtained under #torture & not to resort to the #deathpenalty — Amnesty Bahrain (@aibahrain) February 21, 2018

Long years in jail

In January, a Bahraini court also affirmed a separate, two-year sentence against Rajab for "spreading rumours and untruthful information" against the government in television interviews.

Rajab, who was previously jailed in 2012 and 2014, was re-arrested in July 2016. It took another six months for the prosecutor to investigate and file charges against him, and he later received the two-year sentence.

Since his 2016 detention, he would have spent two years and six months in prison - six months beyond his sentence.

With his latest conviction, Rajab could spend as long as seven years in jail.

Rajab has been a critic of the sectarian divide between the majority Shia population and the island's minority, ruling Sunni government.

In response, authorities ordered the imprisonment of Rajab, as well as other government critics.

Starting in 2011, Shia-led protests erupted across the country, prompting neighbouring Saudi Arabia to intervene on behalf of the Al Khalifa family, which has ruled the kingdom for 200 years.

Demonstrators have been calling for reforms, including the establishment of a "real" constitutional monarchy, with an elected prime minister independent of the ruling, royal family, demands that the government rejected.

Saudi Arabia has accused its regional rival, Iran, of encouraging its Shia-majority population to rise against Bahrain's minority Sunni rulers, allegations that Iran has denied.