But its progress has been blighted by terrorist attacks and economic decline. The Islamic State claimed responsibility for two major attacks in 2015 that killed 60 people, mostly European tourists. In recent years the national debt has ballooned, while soaring prices led to nationwide street protests in January 2018.

Footage taken shortly after the first explosion on Thursday showed debris and what appeared to be body parts scattered across a street near the French embassy. One officer could be seen clutching a wound on his torso and had blood smeared on his neck.

The sense of crisis was compounded by the announcement hours later that Tunisia’s president, Béji Caïd Essebsi, 92, had been taken to a military hospital after suffering a “severe health crisis,” the presidency said in a statement. Later, as reports circulated on social media that Mr. Essebsi had died, the president’s office issued a statement on its Facebook page saying the president was in stable condition.

Mr. Essebsi won Tunisia’s first free presidential election, in 2014. In March, Tunisia’s Truth and Dignity Commission named him for his role in human rights violations in 1963, when he served as a security official under Tunisia’s post-independence leader, Habib Bourguiba.

On Thursday afternoon, a sense of strained normality prevailed in Tunis, as shops reopened near the site of the bombings.

Adnen Belhaj, 28, one of the founders of a co-working space located near the site of the first attack, on Rue Charles de Gaulle in the city center, said he heard noises that he initially thought were the sound of malfunctioning electric wires.

But when he heard ambulances and police sirens, he knew something was wrong.

“Everyone here in the neighborhood was checking Facebook,” Mr. Belhaj said, which is how they found out about the attack.