The extremists have experienced a resurgence since Tunisia kicked off the Arab Spring in 2011 by overthrowing its secular dictatorship.
In what may have been the first suicide attack in Tunisia, hotel security guards stopped the bomber from entering the Riadh Palm hotel in Sousse, a city 90 miles (150 kilometers) south of the capital, Tunis, then chased him to a beach where he blew himself up, the Interior Ministry said.
The ministry described the bomber as dark-skinned and wearing an explosive belt. The city is being searched for possible accomplices, said ministry spokesman Mohammed Ali Aroui.
In the foiled attack in nearby Monastir, an 18-year-old followed a group of tourists into the mausoleum of modern Tunisia's founder, Habib Bourguiba, carrying a backpack full of TNT. He attempted to distract security by tossing a firework before being subdued, said Hicham Gharbi, a spokesman for the presidential guard, which patrols the site.
"He will be questioned to learn his motives and those who ordered the attack," Gharbi told local radio. Bourguiba, Tunisia's first post-independence president, was a fierce secularist and has long been criticized by hardline Islamists.
Riccardo Fabiani, the North Africa analyst for the Eurasia Group said, that coupled with a failed car bomb a few days ago, Wednesday's attacks suggest the start of a new terrorist campaign targeting civilians and tourism.
"A few episodes alone don't necessarily make compelling evidence, but three episodes of this kind point in this direction," he said in an interview. "It was also inevitable to an extent that this would happen sooner or later, if you consider the news over the past few months."
His analysis was echoed by Mokhtar Ben Nasr, the former spokesman for the military, who said the attacks were designed to harm the tourist industry and distract security forces from their efforts to root out militants based in the hinterlands.
Tunisian dictator Zine El Abidine Ben Ali ruthlessly suppressed overt expressions of religion. Since his ouster in 2011, there has been a resurgence of political Islam, including moderates who won elections and hardliners known as salafis.
The salafis were tolerated by the new government led by the moderate Islamist Ennahda Party. But that changed when they began challenging policies they deemed insufficiently Islamic, resulting in increased confrontations between them over the past year.
That culminated in the main salafi group, Ansar al-Shariah, being classified as a terrorist movement in September.