When the front gate to the Tunisian national Parliament was locked, during my visits from 2012 to last year, my research associate and I discovered that we could walk around to the back gate, which was always open so that the public could access the national museum. Eventually, we realised we could even park there, no questions asked.
Unfortunately, terrorists noticed this, too - and 17 tourists were killed on Wednesday in Tunis during an attack on the Bardo, as the Parliament-museum complex is called. This loss of life is more than a blow to the Tunisian tourism industry or the newly elected government. It represents a loss of innocence for the one country that has emerged from the Arab Spring as a constitutional democracy. Tunisia will now have to admit it has a home-grown terrorist movement that wants to undermine the vibrant new institutions the country is so justly proud of having created.
I made multiple trips to Tunisia during the country's constitutional process, both to learn about democracy in action in an Arabic-speaking country and to offer such advice as a professor might give to newly minted politicians who had turned into Constitution-makers. Again and again I was struck by the openness and open-mindedness of post-revolutionary Tunisian society. The openness came with idealism - and the idealism was both well-earned and valuable. Alone among the Arab Spring countries, Tunisia managed a relatively bloodless transition that led to elections under a legitimate, democratic Constitution.
Mutual trust was very important to the success of the constitutional process. Tunisians mostly refused to engage in paranoia or radical denunciations - particularly when measured by regional standards. They insisted on believing the best about one another. Most of the time that trust was rewarded, making negotiations possible.
But a worrisome side effect of the mutual trust was a visibly relaxed attitude towards security. At the airports, I felt as though I had travelled back in time to United States airports in the innocent days before the Sept 11, 2001 attacks. Major political parties had their main offices in quiet streets in residential neighbourhoods, where cars could pull up and park immediately outside. You could meet the most important political figures in the country without even going through a metal detector.
Nowhere was this relaxed attitude more on display than at the back entrance to the Bardo. A guard or two was posted at the car entrance. We were always waved through without a check of our papers or of our car or taxi's boot. The museum entrance was perhaps 15m from the rear entrance to the Parliament, which was generally unguarded. The front entrance, with a couple of guards and a metal detector, was perhaps a two-minute walk away - not that a terrorist would need to use it.
I do not think the lack of security was purely an expression of ideological openness. The laxness was partly an effect of genuine innocence.
Over the last few years, Tunisia saw some targeted attacks on public figures, such as leftist politician Chokri Belaid. But more indiscriminate attacks on tourists or government buildings seemed somehow unimaginable - even though it had been barely a decade since the 2002 attack on the ancient synagogue of El Ghriba on the Tunisian island of Djerba, which killed 21. In the aftermath of the largely peaceful revolution, I think, Tunisians genuinely found it difficult to imagine that their society would be riven by terrorism.
But the rise of radical forms of Salafism has not gone unnoticed. It has been widely reported that as many as 3,000 Tunisians have travelled to Syria to join the Islamic State in Iraq and Syria (ISIS). Towards the end of its time in office, the transitional coalition government led by the Islamic democrats of the Ennahda movement declared itself in a war against "jihadi terrorism".
I have not been to the Bardo in more than a year, since the Constitution was approved, and the security may have been improved in the meantime. In any case, the terrorists seem to have targeted tourists at the museum rather than entering the Parliament building - although maybe they had hoped to do both.
But the Tunisian government will now have to wake up and acknowledge that the enemies of constitutional democracy view the success of the Tunisian experiment as a threat to their own vision of Islamic law and governance.
There is a broader lesson here, beyond the loss of innocence. Fighters of the Al-Qaeda type like to argue that they are waging a defensive jihad against occupying non-Muslim forces. But Tunisia is an independent country. Its reform process was driven from within, by a domestic revolution. Islamic parties, including Salafis, competed in free elections. Islamic democrats won a plurality in the first round, and willingly gave up power when they lost in the post-constitutional elections for the national assembly and the presidency.
There is no credible way for Islamists to claim that the government of Tunisia is illegitimately imposed from the outside. The only claim they can make is that, like ISIS, they are prepared to kill innocents to establish a government based on religious law. This represents part of a transformation in the international Islamist movement from Al-Qaeda anti- imperialism to ISIS triumphalism. Its primary target is not the West, but the populations of Muslim-majority states. And it is they who will have to find the answer.