A suicide bomber purportedly from an Islamic State affiliate has unleashed the first terrorist attack in Kuwait in more than two decades, killing at least 25 people and wounding scores more at a Shiite mosque.

The bombing struck the Imam Sadiq Mosque in the residential neighborhood of al-Sawabir in Kuwait's capital, Kuwait City, after Friday prayers.

It is one of the oldest Shiite mosques in Kuwait, a predominantly Sunni Arab nation where at least at third of the population is believed to be Shiite.

It was the third attack in five weeks claimed by a purported IS affiliate calling itself the Najd Province, a reference to the central region of Saudi Arabia where the ultra-conservative Sunni ideology of Wahhabism originated.

The upstart IS branch had claimed two prior bombing attacks on Shiite mosques in Saudi Arabia that killed 26 people in late May. The group was unheard of until the first Saudi bombing.

The attack took place as worshippers were standing shoulder to shoulder in group prayer, according to one of the witnesses at the mosque, Hassan al-Haddad.

The explosion ripped through the back of the mosque, near the door, he said, adding that other worshippers behind him said they saw a man walk in, stand in the back with worshippers and detonate his device.

Another witness, Ahmed al-Shawaf, said he heard a man interrupt prayer by shouting "Allahu Akbar", or "God is great" in Arabic several times. The man then yelled out something about joining the Prophet Mohammed for iftar, the dusk meal with which Muslims break their daytime fasting during the holy month of Ramadan, which started last week.

Then, the blast came, Mr al-Shawaf said.

The explosion took place near the end of a second prayer, which is traditional to Shiites and follows the main midday Friday prayer.

The Interior Ministry said 25 people were killed and 202 wounded. Police formed a cordon around the mosque complex immediately after the explosion, banning people from entering or gathering near the area. Ambulances could be seen ferrying the wounded from the site.

A posting on a Twitter account known to belong to IS claimed the explosion was work of a suicide bomber wearing an explosive belt. It said the attack was carried out by the Najd Province.

Immediately after the attack, Kuwait's ruler, Emir Sabah Al-Ahmad Al-Sabah, who is in his mid-80s, visited the site of the attack. The cabinet convened an emergency session later. Justice and Islamic affairs minister Yaacoub al-Sanea condemned the attack in a statement carried by the official Kuwait News Agency.

But the attack also drew accusations from some who said Kuwaiti leaders should have been more proactive in protecting Shiites, and that their response to the attack was too little too late.

The last major attack in Kuwait was in 1983, when Iranian-backed Shiite militants from Iraq carried out bombings that killed at least five and wounded nearly 90.