The killings in the Tunisian resort of Sousse happened at about the same time as a bombing at a Shiite mosque in Kuwait and an attack on a US-owned factory in France that included a beheading.
It was unclear if the violence was linked but it came days after the IS militants urged their followers "to make Ramadan a month of calamities for the nonbelievers." In all, at least 63 people were killed.
Rafik Chelli, the secretary of state of the Interior Ministry, told The Associated Press that the attack was carried out by a young student not previously known to authorities. The rampage at the RIU Imperial Marhaba hotel ended when he was shot to death by police.
"He was certainly involved with certain extremists," Chelli said.
More From This Section
The IS group claimed responsibility for the suicide bombing at the Shiite mosque in Kuwait City that killed at least 25 people, while a man with ties to Islamic radicals rammed a car into a gas factory in southeastern France, where a severed head was found on a post at the entrance.
The carnage in Tunisia began on the beach, where tourists described hearing what sounded like fireworks and then running for their lives when they realized it was gunfire. Video of the aftermath showed medics using beach chairs as stretchers to carry away people in swimsuits.
"He had a parasol in his hand. He went down to put it in the sand and then he took out his Kalashnikov and began shooting wildly," Chelli said.
The Health Ministry said the 37 dead included Tunisians, British, Germans and Belgians, without giving a breakdown.