Two life-long friends from Saudi Arabia's Shi'ite minority who stopped an Islamic State (Isis) suicide bomber storming a mosque, are being hailed as heroes after being killed when the terrorist blew himself up.

Mohammed Hassan Ali bin Isa and Abdul-Jalil al-Arbash, who working as security volunteers at Friday prayers, saved many lives when they turned away the bomber, who was disguised as a woman, from the Imam Hussein mosque in Dammam on 29 May.

IS claimed responsibility for a suicide attack that killed four people, including the two friends. According to a statement posted on social media, the attack was carried out by a Saudi native called Abu Jandal al-Jazrawi.

IS called the attack a "blessed martyrdom operation" targeting "an edifice of polytheism that non-believers planted amid the Sunnis in a bid to spread their evil against the true believers".

The statement went on to call the Shi'ite mosque an "evil congregation of impure people".

"We reiterate our call for believers and monotheists in the Arab world: Flee to victory of your religion and carry out the prophet's will to purify the holy land from the impure rafidi [non-believers]," the statement read.

The blast occurred one week after the deadly suicide bombing in Qatif that left 21 people dead, including two children. IS claimed responsibility for the Qatif attack.

According to initial reports, the Dammam mosque suicide bomber attempted to blow himself up inside the women's section of the mosque.

He found the female entrance closed, returned to the main gate of the mosque and was stopped from entering by Isa and al-Arbash. At that point, he detonated the bomb killing himself, the two volunteers and another man.

"They saved a lot of lives by stopping the bomber from getting inside the mosque," a local man, who asked to remain anonymous, told Middle East Eye. "They are both heroes."