Image copyright Tapu Javeri/LLF Image caption The Alhamra Arts Centre hosted the third Lahore Literary Festival

A suicide bomber struck in the Pakistani city of Lahore, just two days before its annual literary festival was due to start.

The night before, the provincial government tried to stop the three-day festival from going ahead, insisting it was not safe.

Then, on the day itself, the darkest of storm clouds invaded, stealthily smothering the light. A warm winter's morning was eerily transformed into an ominous night.

And, through a procession of threats, there was that word: Lahore.

"A Literary Festival in Lahore? Blimey!!!" someone said to me on Twitter.

"Is it safe for me to come to Lahore?" an anxious friend emailed from Cairo. "My family is worried after news of the suicide bombing."

Standing ovation

Some, but not all, ambassadors cancelled. Armed guards were posted inside the gates and the Pakistani army and police vowed to protect a precious space.

Image copyright Tapu Javeri/LLF Image caption Talks and lectures attracted capacity audiences

Image caption Historian Romila Thapar, second from right, gave the keynote address to open the festival

When the city's array of historic clock towers struck 11:00 on 20 February, the third Lahore Literary Festival started with an intellectual bang: a keynote address by the remarkable 83-year-old Romila Thapar.

The eminent Indian historian, who travelled from the neighbouring country still often cast as Pakistan's oldest and most intractable of rivals, spoke of history as "a dialogue between the present and the assumed past".

She was given a standing ovation.

Stellar landscape

But, if anything, this festival was a statement about the future - the fate of an anxious city in a nation troubled by rising violence and intolerance, including very real threats to its artists and activists.

If the festival's schedule was a blueprint, it is a future which treasures a past that includes jewels like Noor Jehan - known as the Empress of Song - as well as literature of many centuries gone by, in many local languages.

Image copyright Tapu Javeri/LLF Image caption There was a carnival-like atmosphere at the festival

Image caption The three-day event kicked off on Friday 20 February

Image caption Lahore is known as "the city of gardens" even if parts are now threatened by urban expansion

It is a future which includes a stellar landscape of contemporary writers, from Kamila Shamsie and Saba Imtiaz of Karachi to Mohsin Hamid and Moni Mohsin of Lahore.

And it is a future based on rare hope that age-old conflicts can be resolved in years to come.

Awareness of danger

This was not just an occasion for poetry and prose, but politics too.

When a packed session was asked if they believed there was a new moment and opportunity in a long-poisoned relationship between Pakistan and Afghanistan, hands shot up across the rows to convey a resounding "yes".

A discussion on India and Pakistan was entitled, Anticipating Peace. And China was cast as a mediator, not a meddler, in efforts to secure peace with the Afghan Taliban.

Image copyright Tapu Javeri/LLF Image caption The reaction from audiences gave an insight into the feelings of Pakistan's more privileged population

Image copyright Tapu Javeri/LLF Image caption Held under tight security, the festival was a bubble of art, literature and ideas

The resonance in the halls was in itself a barometer of a people's mood, or at least that privileged part of Pakistan that wants to will a beleaguered nation to a different place.

A sense of patriotism, a desire for progress and an awareness of danger were all palpable.

One of the festival organisers, writer and journalist Ahmed Rashid, received a loud round of applause when he spoke of the need for debate among "we, as modern Muslims".

There was argument over whether it was possible or even preferable to talk to the Afghan or Pakistani Taliban, disagreement over whether powerful neighbours like China and India were friend or foe, and what limits should exist on freedom on expression. At least one participant, on his Twitter feed, praised the killers of the Charlie Hebdo cartoonists in Paris in January.

Open and engaged

"Why are we discussing Islamic State (IS) in a literary festival?" exclaimed, only half in jest, the Lebanese comic novelist Rabih Alemeddine during a panel on the Middle East. It drew a ripple of laughter but many more knowing looks. This is a country which already contends with all too many extremist groups, and where IS is also known to be recruiting.

This was a celebration of a Pakistan open and engaged with the many ideas of many worlds.

Image caption The festival attracted people of all ages and all walks of life

American feminist Eve Ensler, famous for her Vagina Monologues, discussed her memoir, In the Body of the World, while another session was entitled Fifty Shades of Feminism.

New York Times columnist Roger Cohen spoke about The Girl from Human Street, his new book about a family journey which is also a history of the Jewish people.

For three days, people of all ages, from all walks of life, packed into the Alhamra Arts Centre in a city still known as "the city of gardens" even if some of those green spaces are now threatened by urban expansion and unchecked development.

In a heavily-fortified bubble, balloons bobbed above the lawns, samosas sizzled in metal cauldrons and musical strains of popular Ghazals wafted across the site.

Galleries exhibited artworks dealing with themes that ranged from the persecution of minorities to art itself.

And in this contemplation of a city and its causes, others found kindred souls.

"It reminds me Cairo," exclaimed Egyptian writer Yasmine El Rashidi, who spoke of "echoes of Cairo" in Lahore's "mysticism and beauty".

"It's like Beirut in ways," remarked Lebanon's Rabih Alameddine who invoked a description of his own city, calling it "the Elizabeth Taylor of cities… Insane, beautiful, falling apart, ageing and forever drama-laden".

He may also have meant a battle to keep both beauty and spirit intact.

That, in a few words, was Lahore in its festival days.