Concrete barriers, razor wire and armored vehicles buttress the high walls of the sprawling residential compounds here that house American workers and thousands of other Westerners, an extra layer of protection designed to thwart suicide bombers.

Recently, similar defenses have been installed at dozens of other sites in this capital city that were once considered unlikely terrorist targets: large government office buildings, palaces belonging to the royal family and the headquarters of the Interior Ministry, a giant inverted pyramid that houses the military and internal security agencies.

As these countermeasures show, it is becoming increasingly clear to the government and many Saudis that the campaign of violence that erupted here a year ago is aimed not only at Westerners long reviled by Islamic radicals, but at the royal House of Saud as well.

If the truck bombing of the main police station here seven weeks ago didn't make that plain, the message was delivered again May 29, when an al Qaeda-inspired group took hostages and killed 22 people at a compound for foreigners in Khobar, along the Persian Gulf.

Afterward, the organization calling itself al Qaeda of the Arabian Peninsula released a stream of statements on the Internet, denouncing members of the royal family as "tyrants," accusing them of plundering the nation's oil wealth and serving notice that their grip on power was under serious challenge.

On Monday, the same group released another statement warning of pending attacks on Western airlines and other targets. Saudi officials said the same militants were responsible for an attack on a BBC crew in Riyadh on Sunday that left a cameraman dead and a correspondent seriously wounded.

The brewing conflict between the government and the militants has forced many people here to reassess where they stand. In a nation where large segments of society support native son Osama bin Laden's efforts to destroy the United States and its Western allies, mainstream Saudis who cheered him are starting to realize that the government bin Laden and his followers really wanted to topple all along was their own.

"Many people thought that this was just talk, people saying extremist things, but that's it, just talk," said Abdul Muhsen Akkas, a member of the Saudi consultative council, a group that advises the royal family. "Somehow, we had the belief that our people would never cross that bridge" and attack the kingdom's economy and social structure.

Khalil Khalil, a professor at Imam University in Riyadh, said he used to warn fellow Saudis that bin Laden's primary desire was to oust the royal family that exiled him a decade ago, but that few wanted to listen. Khalil described one woman who told him God would make him suffer for saying such things, adding that she admired and loved bin Laden so much for fighting the United States that she was willing to leave her husband and four children to serve him.

Recently, however, that woman and many others have been expressing second thoughts, Khalil said. Since May 2003, the revolt by al Qaeda loyalists has resulted in 85 deaths and more than 300 wounded, with many Saudis and other Muslims among the casualties.

"I often said we should try to fight bin Laden together and clean the world of these dangerous extremists," Khalil said. "But until a year ago, no one would have thought that here. Many people like what bin Laden says. His actions are not what they are all about, but his slogans, yes. That is the question we have in Saudi Arabia: How do we deal with the people who like bin Laden's slogans, his ideas? It's hard."

The ruling family has vowed to wipe out the insurgency and shows no sign of losing its hold on power. But its members have become sufficiently concerned that some are making a renewed effort to retain the allegiance of their subjects.

In a column published last week in the government newspaper al-Watan, Saudi Arabia's ambassador to Washington exhorted the public to "mobilize for war" against the militants, urging Saudis to reject al Qaeda's charges that the government has become corrupt and too cozy with the West.

"We have a religious and national obligation not to be tempted into following those who have misled us, [those who are trying] to persuade us that the flaw lies with us, as a state and as a people, and that this terrorist phenomenon is the result of the cultural situation in which we are living," wrote Prince Bandar bin Sultan.

On Friday, Saudi Arabia's highest religious authority -- a committee controlled by the government -- issued an edict stating that it was every citizen's moral duty to report or turn in suspected extremists. The declaration contrasted sharply with government policy during the 1980s, when thousands of Saudis were encouraged to travel to Afghanistan to join a U.S.- and Saudi-financed Islamic insurgency against Soviet occupation forces. Many of them attended bin Laden's guerrilla training camps, and hundreds of millions of Saudi dollars financed radical Islamic causes around the world.

The royal family has been slow to acknowledge the seriousness of the threat presented by bin Laden's followers and Islamic militants. In November 2002, Prince Nayef, the interior minister whose agency is now surrounded by barricades, bluntly declared that no al Qaeda cells existed in the kingdom.

Six months later, on May 12, 2003, suicide bombers attacked a housing compound for foreigners in Riyadh, killing 35, including the assailants, and wounding about 200 people. Six months after that, an al Qaeda gang bombed another compound in Riyadh within sight of a royal palace, this time resulting in 17 deaths and 122 people wounded.

The government says it has foiled dozens of other terrorist attacks in the making, arresting hundreds of suspected militants and seizing large caches of explosives and ammunition.

Prince Turki al-Faisal, the Saudi ambassador to London and former intelligence chief, said in a speech last week that 75 percent of all militants believed to be operating in Saudi Arabia had been killed or captured. Other government leaders confidently assert that the insurgency is wobbling and will collapse after its last few leaders are rounded up.

But for now, the bombings and assassinations are having their desired effect. Westerners are leaving the country, depriving the Saudi economy of expertise needed to run operations from oil wells to dental clinics. Oil prices worldwide have soared, in part because of concerns that terrorists might blow up a pipeline or a major petroleum installation.

The frequency of attacks is also on the rise. Last week, gunmen fired on a pair of U.S. soldiers in Riyadh, while two other militants were killed in a firefight with security forces in Taif, in the western part of the kingdom. Two weeks ago, a German was gunned down while visiting an automated teller machine in the capital.

At times, the government's response has appeared weak and ineffective. In December, officials released a list of the kingdom's 26 most-wanted terrorism suspects. Only eight have been apprehended.

In last week's hostage-taking in Khobar, three of the four gunmen escaped even though they were surrounded by hundreds of Saudi security forces. At first, Saudi officials suggested that they were able to flee by using some of the hostages as shields. Later, other officials said the gunmen were allowed to escape after they threatened to blow up a building by remote control unless they were given free passage.

Whatever the reason, the fact that three of the perpetrators remain on the loose has given the group a huge propaganda victory.

"They are euphoric. They've done what almost nobody has done in the history of hostage-taking: They got away with it," said Saad Fagih, a Saudi exile in London who heads the Movement for Islamic Reform in Arabia, a group that advocates greater freedoms in the kingdom and the downfall of the monarchy. "It was pure incompetence on the part of the Saudi security system. Hopeless incompetence."

Few people are predicting that the insurgency will cause the House of Saud to collapse, but worries about the kingdom's stability are growing.

Alex Standish, editor of the London-based Jane's Intelligence Digest, said the situation in Saudi Arabia has strong parallels to the fall of the shah of Iran, another U.S. ally, who was toppled in his country's Islamic revolution in 1979.

"I think the Saudi royal family has been in denial for far too long," Standish said. "In the past, their tendency was to buy off critics. But they can't do that here. There's a lot of evidence to suggest that this organization is gathering strength."

The royal family is also hobbled by factionalism and aging leaders. King Fahd has been incapacitated for years by a stroke. Crown Prince Abdullah, the de facto ruler, was born in 1924. His half-brother, Prince Sultan, the next in line, is 76. It is unclear who will emerge from the next generation to take their places.

"The regime in Saudi Arabia today is a regime of old men. It is like the Soviet days," said Ferhad Ibrahim, a political science professor and Middle East specialist at the Free University of Berlin. "They don't have a strategy against the terrorists. They have a crisis. The whole political system has a hard time functioning."

Even so, some Saudi intellectuals say, the attacks have renewed popular support for the government and sparked a backlash against the militants. They say many Saudis are afraid that al Qaeda is trying to ruin the nation's economy and isolate the kingdom from the rest of the world.

"It's a great shock to people. They never expected such a thing to be carried out on Saudi soil, by Saudis," said Abdul Aziz I. Fayez, another member of the consultative council. "Here you have a society that for three years now has been accused of being a breeding ground for terrorists. Now people are seeing that we are victims of terrorism as well."

Defenses like these at a compound for foreigners in Riyadh are being installed at Saudi government buildings as well.