ISTANBUL — Courts in Bahrain and the United Arab Emirates on Monday upheld the convictions of two prominent human rights activists serving lengthy prison terms for expressing anti-government dissent on social media, according to lawyers and human rights groups.

 The activists, Nabeel Rajab and Ahmed Mansoor, have no right to further appeal.

 The court decisions, issued in Persian Gulf monarchies that the Trump administration considers among its closest Arab allies, were condemned by human rights groups as unacceptable attacks on free speech. The cases also highlight the increasingly aggressive policing of social media by several of the gulf states, which have punished people for criticizing their governments and allied foreign countries.  

Bahrain’s highest court upheld a five-year prison sentence imposed on Rajab, who was convicted earlier this year for social media posts he wrote in 2015 that criticized airstrikes by a Saudi-led military coalition in Yemen and accused prison authorities in Bahrain of abusing prisoners, according to his lawyer and the Bahrain Institute for Rights and Democracy, an advocacy group.  

The charges against him included insulting state institutions and insulting a neighboring country — a reference to Saudi Arabia, Bahrain’s closest ally, according to the Bahrain Institute.   

The prosecution of Rajab is part of a years-long crackdown on dissenters and political opponents that began when Bahrain’s monarchy forcefully suppressed a pro-democracy uprising in 2011 with the help of troops from other gulf states. Rajab, a leader of the protest movement and a co-founder of the Bahrain Center for Human Rights, has been a frequent target of the authorities and served a separate two-year prison sentence for criticizing the government during a television interview.

Bahrain’s government has accused protesters of carrying out violent attacks on the security services.

 “Today’s shameful verdict is a travesty of justice,” Lynn Maalouf, Amnesty International’s Middle East Research director, said in a statement. “The decision to uphold Nabeel Rajab’s conviction and five-year sentence simply for posting tweets expressing his opinions, exposes Bahrain’s justice system as a complete farce.”

An emailed statement from Bahrain’s government communication and media relations directorate said that Rajab “was afforded his full legal rights, including the right to appeal and continued access to legal counsel.”

The statement added: “The Kingdom is fully committed to an inclusive pluralistic society, however, as in all countries, criminal offences cannot be allowed to go unchecked. The right to freedom of expression is clearly enshrined in Bahrain’s constitution and guaranteed by Bahraini law, and the government continues to uphold these principles robustly.”

The Trump administration has sought to strengthen its alliance with Bahrain and its gulf neighbors as part of the U.S. strategy to counter Iran, while avoiding arguments with them over human rights. Last year, President Trump assured the king of Bahrain that ties between the two countries would be free of “strain” that had occurred in the past between the two governments, in an apparent reference to the Obama administration’s criticisms of rights abuses in Bahrain.  

In the United Arab Emirates, the Federal Supreme Court on Monday upheld Mansoor’s 10-year sentence for “defaming” the country on social media, according to Human Rights Watch. He was also ordered to pay a fine of $272,000 and will remain under surveillance for three years after his release, according to the National, an Emirati newspaper. 

In the weeks before his arrest last year, Mansoor, 49, had “criticized the UAE’s prosecution of activists for speech related offenses” and posted messages on Twitter highlighting human rights abuses elsewhere in the region, Human Rights Watch said.

Mansoor is a past recipient of the Martin Ennals Award for Human Rights Defenders, which is given annually by a jury composed of 10 leading international human rights groups. A biography of Mansoor on the Martin Ennals award site called him “one of the few voices within the United Arab Emirates who provides a credible independent assessment of human rights developments in the country.”