In Saudi Arabia, Britain's most lucrative arms market, Raif Badawi, has been told he will be flogged again 50 times on Friday. The Saudi liberal has been accused of ridiculing the kingdom's religious police.

On Tuesday next week, Nabeel Rajab, a citizen of another Gulf kingdom with which Britain is building up closer militsary ties,, is due to appear in court on charges of "insulting a public institution" over Twitter.

Rajab is president of the Bahrain Centre for Human Rights. He accused the Bahraini security forces of encouraging violent beliefs similar to those of Isis.

His offending tweet read: "Many #Bahrain men who joined #terrorism & #ISIS came from security institutions and those institutions were the first ideological incubator." If he is found guilty he faces up to six years in prison.

In one of the most brazen displays of hypocrisy in the wake of the Charlie Hebdo attacks, ministers from Bahrain and Saudi Arabia were among those who marched in support of freedom of expression in Paris last week.

Human rights groups have urged Britain to intervene more vigorously in Badawi's case and for Philip Hammond, the foreign secretary, to urge the Bahrain government to drop the charges against Rajab.

The British government has repeatedly said it is concerned about the lack of human rights in Saudi Arabia. The Commons foreign affairs committee last year said the Foreign Office should have bitten the bullet and designed Bahrain as a "country of concern".

But Britain has made it clear that arms sales and military and security considerations must take priority over human rights, even torture.

So it backs away from upsetting the Saudi government. And instead of applying pressure on Bahrain to introduce reforms, Britain has signed what the government has called a "landmark" agreement establishing a permanent UK naval base in the Gulf kingdom. The Bahrain government will pay for it, with Britain contributing to the running costs of some £15m a year.

"The agreement reaffirms the UK's and Bahrain's joint determination to maintain regional security and stability in the face of enduring and emerging regional challenges", Michael Fallon, the British defence secretary, told the House of Commons last month.

Labour and Liberal Democrat MPs have signed an early day motion in the Commons attacking the naval base deal, saying it sends a message that the UK government is not interested in justice, rule of law and reconciliation in Bahrain, and that the increased British military presence is likely to exacerbate tensions in the region.

The base agreement was greeted with protests in Bahrain with human rights activists described the decision as a reward for Britian 's silence over the jailing of opponents of the Sunni monarchy. "As Bahrain pursues brutal crackdown, what better time for UK to build military base there?" said Kenneth Roth, Human Rights Watch's executive director.

The Bahraini monarchy in 2011 violently repressed a pro-democracy opposition movement led by the country's Shia majority, Doctors who treated protesters were tortured.

According to the Bahrain Human Rights Group security forces arrested 54 people and suppressed 119 demonstrations in the first week of this month alone.

As the regime continued to jail human rights campaigners, Britain last year designated Bahrain as a "priority market" for its weapons.

British arms exports to the Gulf kingdom have increased significantly since the Arab Spring. Over the past year, they have totalled £17m, and included machine guns, hand grenades, and military training equipment, according to official figures collected by the Campaign Against the Arms Trade (Caat).

The government has helped to sell BAE Typhoon fighter jets to Saudi Arabia and (with the help of Prince Andrew last year) is trying to sell Typhoons to Bahrain.

The Head of Advocacy for the Bahrain Institute for Rights and Democracy, Sayed Alwadaei says: "As an award for the British role in misleading the international community, Bahrain is building them a base. This also demonstrate why Britain has refused to list Bahrain as a country of concern".

Andrew Smith from Campaign Against Arms Trade says: "The UK government has put a lot of time, effort and political capital into arming and supporting the Bahraini regime. With the new naval base, and with the possibility of Typhoon sales on the horizon, this looks unlikely to change."

The British government argues that if Britain did not sell the arms to Saudi Arabia and Bahrain, opther countries, including France, would.