By Angus McDowall
QATIF, Saudi Arabia (Reuters) - When the gunshots rang out, Ali, a 26-year-old Saudi Arabian Shi'ite Muslim, thought they were fireworks. But when he saw people running, he knew militant Sunnis were attacking his minority community again.
Minutes later, five of his neighbors lay dead.
The Oct. 16 shooting was the fourth attack by Islamic State jihadists against Saudi Shi'ites within 12 months, leaving 40 dead and unnerving a community whose position in an ultra-strict Sunni kingdom has rarely felt so precarious.
The fate of Saudi Arabia's 2 million or so Shi'ites is closely watched because of Riyadh's intimate involvement in the region's sectarian conflict through its rivalry with Iran and the teachings of its influential clergy that Shi'ism is heretical.
Saudi Shi'ites have long complained of discrimination, but they are now subject to violent attack and, adding to their unease, fear that another 16 young men will be added to the list of seven facing beheading for joining protests in 2011-12.
The Saudi government denies discrimination and says those convicted in the protests committed deadly violence. Families of the protesters say the demonstrations were peaceful acts against discrimination and in favor of democracy.
What many people in the Shi'ite-majority Eastern Province district of Qatif say is that an atmosphere of tolerance for sectarianism, visible in comments by Sunni clergy, in school textbooks and online, is feeding the danger they now face.
Days after the most recent attack, Ali traced the gunman's route along a main road and down a dusty alleyway, towards where Shi'ites were commemorating the runup to Ashura, the annual ritual honoring the martyrdom of the Prophet Mohammad's grandson Hussein, central to the Shi'ite calendar.
"Here on the corner, he shot Ayman al-Ajmi and Ali Aseri. There in the empty lot he shot Abdullah al-Jassim. This is where Doctor Buthaina al-Abad was running with her children. He shot her in the heart," he said, describing the gunman's trail of bloodshed.
For, Shi'ites the annual commemoration of the seventh century death of Hussein in the battle of Kerbala in Iraq, which fell on Saturday, is the moment when their role as a minority is most keenly felt.
To the beat of a drum and the wailing laments of a religious leader, a hundred or so men in the nearby Qatif village of al-Qudeih, site of a suicide bombing in May that killed 23, whipped their backs with chains on Saturday until the blood flowed.
"This is a small Kerbala. We are attacked, the same as in Kerbala, just like Imam Hussein," said Ali al-Rabeh, a retired worker at the state oil company Aramco.
Saudi social media messages on the Internet contain increasingly open incitement against Shi'ites, which has worsened since Saudi Arabia began leading a military campaign against members of a Shi'ite militia in neighboring Yemen this year.
Although the Saudi government says it does not tolerate extremism, senior state-employed Sunni clerics often decry the sect's practices as heretical, and newspapers publish tales of Shi'ite violence against Sunnis in neighboring states.
The government won praise from some Saudi Shi'ites for quickly responding to the attacks by invoking national unity, sending senior princes to attend funerals and boosting security at the sect's holy places alongside local volunteers.
It also arrested a cleric last year for a social media post reveling in the death of Shi'ites in Yemen. But Shi'ites say the authorities should do more to curb such dangerous speech.
Supporters of the ruling Al Saud family say they are constrained by the ultra-conservative beliefs of most Saudis, followers of the rigid Wahhabi Sunni school founded on a mission to purge Islam of incorrect belief - Shi'ism included.
The Al Saud have always ruled in alliance with the Wahhabi clergy, who bolster the rulers' legitimacy in a country without democratic elections, and who in return control the judicial system and enjoy great sway over education and public morality.
Reuters was allowed to visit Qatif only with Saudi government officials, and the interviews in this article took place in their presence.
Across Qatif, mourning flags in black, green, red, white or gold fluttered from rooftops, men wore black robes or t-shirts and the melancholy sound of chanted laments echoed from mosque loudspeakers.
Such displays are anathema to many Sunnis, particularly Wahhabis, who regard Shi'ite veneration for Hussein as bordering on polytheism and view denunciations of the ruler who had him killed as slander against an early Muslim leader they admire.
A widely circulated clip on YouTube this year showed Saudi Arabia's Grand Mufti Sheikh Abdulaziz Al al-Sheikh, the top Wahhabi authority, describe such funereal processions as "innovation", a Muslim legal term to describe deviant religious practices.
His comments caused dismay in Qatif. In a country where blasphemy and apostasy can be punished by death, such accusations of religious deviance might inspire attacks by militants, Shi'ites argue.
"If we live in a more tolerant society, then we can understand each other and know what's going on more evenly. But here everyone looks at each other with suspicion," said Jafar al-Shayab, a Shi'ite community leader in Qatif.
Some Shi'ites believe the Al Saud family's need to appease its Wahhabi constituency, combined with the clerical control of the judiciary, is what led to the death sentences against a cleric and six young men and upheld by appeals courts this year.
They were convicted after protests in which over 20 Shi'ites and a policeman were killed, most in what the government described as "exchanges of fire" after police were attacked, but which activists said included shootings of peaceful demonstrators. The government has stressed in statements that the judiciary is independent.
In Qatif, people are worried that the demonstrators, two of whom were only 17 at the time of the protests, could be beheaded at any time. They are then sentenced to have their bodies displayed as a warning to the public.
But few Saudi political analysts expect those sentences to be carried out, seeing them instead as a stern warning to Shi'ites not to take to the streets again, and a sop to Sunnis angry over the detention of thousands of suspected militants.
"They should just sit with us and see. I don't know why they hate the Shia. Shia don't do anything to them, but they just hate," said Ahmed, a 27-year-old airport worker, as the boom of drums and crash of chains on skin resounded around him.
(Editing by Peter Millership and Peter Graff)