This is the terrifying moment a gunman wearing suicide belt blew himself up inside a Shia mosque in the eastern Saudi Arabia's al-Ahsa province during Friday prayers.

Footage of the attack, which killed at least three people and wounded seven, shows the instant the bomb went off, breaking windows and causing a blackout.

During the confusion and chaos that followed, people can be heard shouting invocations to Allah as they try to escape the mosque. Gunfire is also heard outside as worshippers begin to panic.

Scroll down for video

Footage of the attack shows a room inside the mosque going dark as an explosion is heard. Gunfire can be heard outside

The attack struck the Imam Reza Mosque in the neighbourhood of Mehasin, an area popular with Shia workers of the state-run Saudi Arabian Oil Co.

During the confusion and chaos that follow the explosion, people can be heard shouting invocations to Allah as they try to escape the mosque

The attack struck the Imam Reza Mosque in the neighbourhood of Mehasin, an area popular with Shia workers of the state-run Saudi Arabian Oil Co., the world's largest oil-producing firm.

While one of the attackers detonated his explosives, the other opened fire - but was quickly stopped from blowing himself up.

Another video from the scene showed worshippers attacking the second militant inside the mosque. The gunman is seen laying on the ground surrounded by an angry mob who starts kicking and punching him.

While one of the attackers detonated his explosives, the other opened fire - but was quickly stopped from blowing himself up

The second gunman, who failed to detonate his suicide belt, is seen laying on the ground surrounded by an angry mob who starts kicking and punching him

ASaudi worshipper removes the suicide belt from the militant

The clip continues with graphic footage of injured people covered in blood

At some point, a Saudi worshipper removes the suicide belt from the man. The clip continues with graphic footage of injured people covered in blood.

Saudi police had to fire assault rifles into the air to drive away the mob that surrounded a police car holding the suspected attacker.

Shia in Saudi Arabia make up some 10 to 15 percent of the ultra-conservative, Sunni-ruled kingdom's population.

The graphic video shows injured worshippers inside the Imam Reza Mosque in the neighbourhood of Mehasi. The attack took place during Friday prayers

Another Shia worshipper is seen laying on the ground after the attack

Bodies can be seen one on top of each other inside the mosque after the suicide blast

The minority group, many of whom live in the country's oil-producing east, previously have been targeted in attacks by the Islamic State group, which views Shiites as heretics.

In August 2015, Daesh claimed responsibility for a suicide bomb that killed 15 worshippers.

In May, a suicide bomber killed 21 and wounded 81 in the village of al-Qadeeh, again during Friday prayers.

No group immediately claimed Friday's attack.