Naguib Mahfouz, who became the first Arab writer to win the Nobel Prize in literature and who was later stabbed by an Islamic militant who accused him of blasphemy, died Wednesday, his doctor said. He was 94.

Mahfouz, whose novels depicted Egyptian life in his beloved corner of ancient Cairo, was admitted to the hospital more than a month ago after falling in his home and injuring his head. He died Wednesday morning after a sharp decline, said Dr. Hossam Mowafi, head of a medical team supervising his treatment at the Police Hospital.

"His wife last night was whispering in his ears and he was smiling and nodding," said Mowafi.

The prize, awarded in 1988, brought to notice a man who had already established himself as one of the Middle East's finest and most beloved writers and a strong voice for moderation and religious tolerance. But fame had its perils.

In 1994, an attacker inspired by a militant cleric's ruling that a Mahfouz novel written decades before was blasphemous stabbed the then-82-year-old Mahfouz as he left his Cairo home.

Mahfouz survived, but the attack damaged nerves leading to his right arm, seriously impairing his ability to write. A man who had once worked for hours at a time — writing in longhand — found it a struggle to "form legible words running in more or less straight lines," he wrote in the aftermath.

Still, Mahfouz maintained a busy schedule well into his 90s. In his final years, he would go out six nights a week to meet friends at Cairo's literary watering holes, trading jokes, ideas for stories and news of the day.

He continued to work, producing short-short stories, sometimes only a few paragraphs long, dictating each day to a friend who would also read him the newspapers. His final published major work came in 2005, a collection of stories about the afterlife titled "The Seventh Heaven."

"I wrote 'The Seventh Heaven' because I want to believe something good will happen to me after death," the wispy-bearded writer told The Associated Press with a grin during a small gathering for his 94th birthday in December 2005. "Spirituality for me is of high importance and continuously provides inspiration for me."

He explained his tight adherence to routine, saying "I'm a Sagittarius, I was born under a cold sign, so of course I have discipline" — followed by a boisterous laugh.

Across the span of 50 novels, five plays and scores of short stories and essays, Mahfouz depicted with startling realism the Egyptian "Everyman" balancing between tradition and the modern world. Often the scene of the novels did not stretch beyond a few familiar blocks of Islamic Cairo, the 1,000-year-old quarter of the capital where Mahfouz was born.

The crowded neighborhood of alleys and centuries-old mosques is the setting for his masterpiece Cairo Trilogy. The trilogy — "Palace Walk," "Palace of Desire" and "Sugar Street," all of which appeared in the 1950s — details the adventures and misadventures of a Muslim merchant family not unlike Mahfouz's own.

The trilogy introduced a character who became an icon in Egyptian culture: Si-Sayed, the domineering father, who lords his authority over his wives and daughters but holds the family together — a character Mahfouz drew from his own father.

It was his 1959 novel "Children of Our Alley" — known by its English title "Children of Gebelawi" — that brought him the most controversy. It was an allegory for the series of prophets that Islam believes includes Jesus and Moses — Eissa and Moussa in Arabic — and culminates in the Prophet Mohammed.

First serialized in Egyptian newspapers in 1959, it caused an uproar much like Greek writer Nikos Kazantzakis's "The Last Temptation of Christ," published a year later.

Egyptian religious authorities banned it from being published in book form, but it was published in Lebanon and later translated into English.

The controversy was resurrected when Iran's Ayatollah Ruhollah Khomeini ordered the death of British writer Salman Rushdie for his novel "The Satanic Verses" in a 1989 fatwa, or religious verdict.

In a copycat fatwa the same year, Egyptian radical Sheik Omar Abdel-Rahman — later convicted of plotting to blow up New York City landmarks — said Mahfouz deserved to die for "Children of Gebelawi." The attacker five years later was inspired by the fatwa.

The controversy over the book was renewed late 2005, when a monthly magazine tried to publish the novel. Mahfouz said he wouldn't agree to republishing it without the consent of Al-Azhar, the prestigious Sunni Muslim clerical institution in Cairo. His position raised an outcry among many novelists who said he was bending to religious censorship — but it reflected his non-confrontational style and desire to see consensus.

Mahfouz moved easily between genres. His works of social realism painted Egypt's upheavals in the 20th century. Promising young men die fighting British colonial rule, revolutions inspire and then bitterly disappoint, women strain against religious and traditional restrictions, gracious old manners surrender to modern ways.

"It has to do with the plight of humanity as a whole," said Fatma Moussa, a renowned Egyptian critic and writer. "He has presented it from the local angle, but it's not really local at all. It's kind of a microcosm of the whole world, a little image of the fate of man."

But other works were religious or political allegories. In the 1983 novel, "The Journey of Ibn Fattouma," a pilgrim sets out in search of the perfect state. Instead, he finds oppressive regimes that claim to be religions and governments touting the virtues of freedom while trampling on weaker nations.

Mahfouz's mother, an illiterate daughter of an Al-Azhar sheik, had a keen interest in all stages of Egypt's rich past, imbuing the young Mahfouz with a love of pharaonic, Greco-Roman, Coptic Christian and Islamic history. His first novel, "The Curse of Ra," published in 1939, was a drama of pharaonic Egypt.

Mahfouz studied English at King Fouad University, now Cairo University, graduating with philosophy degree in 1934. In a 2001 interview with The Associated Press, he listed Hemingway, Faulkner and Bernard Shaw among his favorite authors.

Mahfouz spent most of his adult life working for the government, his writing a sideline even as he grew more successful.

He once described preparing a parliament speech for the minister of religious endowments. He handed the minister with an envelope containing the speech, then sat down outside parliament to review a short story he also had just finished.

To his horror, he realized he had the speech, and the minister had his story. The young writer rushed into parliament "and exchanged the two envelopes when the minister wasn't looking."

Mahfouz later switched to the Ministry of Culture, holding high positions in its bureaucracy before retiring at 60.

He became the consummate Arab man of letters, craving the company of friends and colleagues at Nile-side cafes. His last novel, 1988's semi-autobiographical "Qushtumar," centers on four elderly friends who meet weekly at a cafe that gives the book its title.

He was strongly political — but kept to a moderate line. Mahfouz was a great defender of the Palestinian right to an independent state and a critic of U.S. foreign policy in the region, particularly over Washington's support for Israel and occupations of Iraq and Afghanistan. But unlike the majority of novelists, writers and artists, Mahfouz has been a supporter of peace treaty with Israel since it was signed in 1979.

Several of his works were made into movies. For many Arabs, his characters can never be separated from the voices and faces of some of Egypt's most popular actors.

"He is this wonderful combination of being popular and being at the same time intellectual and spiritual," said Moussa, the critic.

The Swedish Academy that awarded the Nobel said Mahfouz could be "now clear-sightedly realistic, now evocatively ambiguous."

Raymond Stock, his American biographer and translator of some of his works, said Mahfouz's legacy is to leave great novels and convey his "great love of Egypt."

"He is a great son of Egypt, a patriot in the fullest sense of the word," he said.