LAHORE, Pakistan — Assailed by jihadist attacks and the moral cudgels of religious conservatives, Lahore’s celebrated cultural vitality has waned somewhat in recent years. A famous kite-flying festival is no more; a performing arts festival vanished after being attacked; and music concerts take place in restricted circumstances.

But last month, the city welcomed spring with a raucous new party — a celebration of books.

Thousands of people crammed into a towering red brick building for the inaugural Lahore Literary Festival, flitting between sessions to hear, and meet, their heroes from Pakistan’s swelling firmament of novelists. It seemed as much a rock concert as a scholarly venue, and scuffles erupted as people pushed to gain entry.

One star attraction was Mohsin Hamid, a Princeton-educated native of Lahore, whose new novel, “How to Get Filthy Rich in Rising Asia,” has been published to critical acclaim. Wearing jeans and sneakers, he received a giddy welcome from a home crowd. There was swooning. One man stood up to say that he had come to Lahore specifically to emulate the sex and drug scenes in Mr. Hamid’s novels.

Mr. Hamid was not the only draw: even more esoteric discussions of poetry and writing, or academics cogitating over the country’s troubled trajectory, drew packed houses that surprised even veteran authors.