Saudi Arabia, rattled by regional turmoil that has destabilised the Middle East, is intensifying a crackdown on domestic dissent, raising fears that a more open space for public debate that emerged in recent years is under threat.
Sunni Islamists, Shi'ite Muslims, liberal reformers, atheists and human rights advocates have all been targeted through a series of arrests and new laws in what one activist has described as an "undeclared state of emergency".
Social media, and what analysts describe as King Abdullah's efforts to foster a more open atmosphere since the turn of the century, have given Saudis greater scope than ever before to criticise the authorities and discuss topics once seen as taboo.
However, since the 2011 Arab uprisings, the world's No. 1 oil exporter, has taken a far harsher line against many forms of dissent, jailing liberal reformers and religious critics on charges ranging from sedition to jeopardising state security.
Riyadh's long-ruling dynasty remains firmly in control of the country, where only small-scale demonstrations to push for the release of jailed Sunni militants or liberal activists or by Shi'ites in the Eastern Province occur from time to time.
But it believes it is under attack as never before, say analysts with close ties to the kingdom's elite, and seesSyria's civil war and Egypt's political crisis as posing a domestic threat as well as a foreign policy challenge.
Responding to these perceived threats, Saudi Arabia has passed a set of laws that banned citizens from fighting abroad, donating money to any faction in Syria or sympathising with militant ideologies.
Meanwhile, a new law defines terrorist crimes as any act that "disturbs public order, shakes the security of society, or subjects its national unity to danger, or obstructs the primary system of rule or harms the reputation of the state".
"There is a clear lowering of the ceiling of liberties, a rise in security repression and an increase in legislation of laws that can be used to criminalise political activists," a rights campaigner, who asked not to be identified said.
The kingdom says it does not have political prisoners and does not practice torture, while top officials have defended monitoring of activists as necessary to maintain social stability.
"We don't want things to influence our unity. So if something is going to make our society unstable or disunite our society, we will pay a lot of attention to it," said a senior Interior Ministry official interviewed by Reuters in February.
The new laws have made it easier for the government to punish Saudis for any expressions of criticism or dissent, not only in public gatherings and traditional media, but also on social media.
In doing so, it appears to be reacting to both regional political turbulence and the surge of public debate unleashed by Twitter and YouTube.
Political parties are banned in the kingdom as are protests, labour unions are illegal, the press is tightly controlled and criticism of the royal family can lead to prison.
However, King Abdullah has encouraged reforms aimed at making Saudi society more open to outside influences and encouraged local press to push harder for change, according to local newspaper editors cited by U.S. diplomats in cables released by WikiLeaks.
At the same time, social media has allowed Saudis to push the boundaries of public debate, opening the way for widespread criticism of specific officials and policies in ways that would have been unimaginable a decade ago.
Now, the government has introduced a series of regulations requiring licensing of news websites and threatening punitive imprisonment for dissent on social media.
Earlier this month, three young men from prominent Saudi families were detained for posting online films complaining about living standards and criticising the royal family, said an activist who spoke with relatives.
The New York-based Committee to Protect Journalists has ranked Saudi Arabia among the world's 10 most censored countries, together with Syria, Eritrea and North Korea.
Islamists from the kingdom's conservative Sunni majority are the main focus of government unease, most clearly via a decree that branded the Muslim Brotherhood a terrorist organisation, but also with moves against specific figures seen as a threat.
Wajdi al-Ghazzawi, the Saudi host of Wajd television station based in Cairo, was convicted last year of "harming the nation's image" with programming that was "liable to impact on public security".
But the authorities have also targeted those who appear to deviate from orthodox Sunni belief by making atheism a "terrorist" offence and imposing harsh sentences for people it said have blasphemed on social media.
Government officials have also used harsh language about liberals, as the Islamic Affairs Minister Sheikh Saleh bin Abdulaziz Al al-Sheikh did in comments to al-Hayat newspaper this month. He described "Western liberal trends, Islamist movement trends and non-Islamist ones threatening the country".
In October, authorities detained columnist Tareq al-Mubarak for several days after he published an opinion piece criticising the driving ban and other restrictions on women.
One Saudi official said privately that Mubarak had "crossed a line by trying to organise dissent".
A group of activists imprisoned over the past year after founding the Saudi Civil and Political Rights Association(ACPRA) angered the government by publicising their demands for a constitutional monarchy and accusations about senior figures.
Mohammed Fahd al-Qahtani and Abdullah Hamid were sentenced to 10 and 11 years in jail on charges that included sedition and giving inaccurate information to foreign media. A relative of one of them said they were now on hunger strike, which the government denied was happening.
"The tightening is ... on all political activists demanding reform and popular participation in the political decision making process," the activist said. He said ACPRA was the most "daring" Saudi group in demanding reforms.
Even Riyadh's annual book fair did not escape. Publishers said authorities ordered the withdrawal of more than 400 titles from the display, including works by prominent authors like Palestinian poet Mahmoud Darwish and Iraqi poets Bader Shaker al-Sayyab and Aabdel-Wahhab al-Bayati.
Amplifying Saudi worries about Syria and Egypt, the kingdom's rulers feel surrounded by chaos: Iraq is still torn by sectarian violence while political turmoil casts a shadow over two of the kingdom's other neighbours, Yemenand Bahrain.
"The authorities believe they are in control inside Saudi Arabia, more or less, but they are not sure about the outside impact on Saudi Arabia in the near future," said Mustafa Alani, a security analyst with close ties to theInterior Ministry.
They fear the return of possibly hundreds of hardened militants who have fought in Syria's civil war, remembering attacks from 2003-06 launched by radical Islamists who had taken part in the insurgency in Iraq.
"I think the worry about Syria is more reflected in the recent bit of legislation that mandate prison terms for Saudis who join fights abroad," said Gregory Gause, an associate fellow at the Doha Brookings think-tank.
"I think that's a direct response to the increasing flow back from Syria into Saudi Arabia. But of course that's a movie we've seen before from Afghanistan, from Iraq."
Saudi leaders also fear that domestic expressions of support for the Muslim Brotherhood could complicate their policy in Egypt, their most important Arab ally against a common main rival, Shi'ite Iran, Gause said.
Such concerns have given added weight to domestic criticism over a lack of jobs, housing shortages and government corruption, as well as social debates as to whether the kingdom is moving too quickly towards adopting Western values.
But Ibrahim al-Mugaiteeb, head of the local Human Rights First Society, said security steps were not the answer to dissidents. "We need more than harshness and roughness as we have noticed recently in the sentencing," he told Reuters.
Instead, he said, the government should regard criticism as constructive and that he hoped the authorities would push reforms at a faster pace. "We need more understanding for where people are coming from," Mugaiteeb said.