Saudi authorities said they have arrested six people in connection with a suspected sectarian attack that killed five Shi'ite Muslims in the eastern province al-Ahsa province.

The interior ministry said the six are accused of taking part in terrorist activists related to the shooting in al-Dalwah town, state news agency SPA reported.

Nine people were wounded in the attack. Eyewitnesses said they saw masked gunmen open fire with pistols and machine guns on a group leaving a religious shrine.

Shi'ite Muslims were celebrating Ashoura, one of their most important religious festivals.

The identity of those arrested was not immediately released, with police saying an investigation was underway.

The al-Ahsa province is one of the two main centres of minority Shi'ite community in Sunni-ruled Saudi Arabia and has been at the heart of anti-government demonstrations inspired by the Arab revolutions in 2011.

The Shi'ite minority says it faces discrimination in the workplace and education, and complains of restrictions on setting up places of worship to mark Shi'ite holidays. They are also allegedly belittled in textbooks and by Sunni officials and clerics.

The shooting comes at a time when international rights groups are campaigning to free a prominent pro-democracy Shi'ite Muslim cleric who was at the forefront of the country's protests in 2011.

Sheikh Nimr al-Nimr, who was detained in 2012 after backing mass pro-democracy protests in Qatif, was recently sentenced to death for "aiding terrorists" and "waging war on God".

The gruesome punishment involves beheading followed by a public display of the decapitated body.

A report on Iraq's news site al-Youm al-Samen said the Saudi King Abdullah called off the ruling after receiving a letter of warning from an influential Iranian politician and writer, Akbar Hasehmi Rafsanjani. No official report has confirmed the report.