In February of 1979, Tehran was in chaos. A cancer-stricken Mohammed Reza Pahlavi, the Western-backed autocrat, had gone into exile in mid-January, leaving behind a rickety regency council. On Feb. 1, Grand Ayatollah Ruhollah Khomeini, the godfather of the revolution, returned from exile in Paris. And in the Iranian version of “Ten Days That Shook the World,” street demonstrations raged until the government collapsed on Feb. 11.

Ecstatic Iranians danced in the streets, playing cat and mouse with soldiers as lingering pro-government sharpshooters fired from the rooftops. Families joined in mass protests, as vigilantes ransacked liquor stores and people kissed the foreheads of turbaned clerics leading the revolution.

Forty years ago, Iranians swelled with pride, hope and the expectation of a better future. Dreams of freedom and independence from the United States fired up the revolutionaries. But great, rapid change can leave deep and lasting wounds. There were lashings, hangings, amputations and mass imprisonment. Thousands of people died and hundreds of thousands left the country, some fleeing for their lives, never to return.

What materialized after those first bloody years was truly revolutionary: an Islamic republic, a theocracy built on ideological choices inspired to a great extent by Ayatollah Khomeini.

New rules were put in effect to forbid anything that might lead people astray and prevent them from ascending to a heavenly afterlife: strict controls on the media, which isolated Iranians from Western influences; an absolute segregation of the sexes in public places; compulsory head scarves for women; bans on alcohol and musical instruments on television; rules forbidding women to ride bicycles. It went on and on, zealously and sometimes brutally enforced by the morality police and the paramilitary Basij forces.

But over the years, as the early revolutionary fervor gave way for most people to a yearning for a more normal existence, the rules became negotiable. While the political system is basically the same as in those early years, the society changed slowly, at times almost imperceptibly. Those changes have been enormous, and the Iran celebrating the 40th anniversary of the revolution on Feb. 11 is closer than most outsiders generally appreciate to being that “normal” country Iranians want.