The court found 12 other defendants guilty of conspiracy to murder, possession of weapons and other offences, while two were found not guilty.
The verdict passed on Mohammed Nagi Mustafa and Mohammed Mahalawi brings the number of death sentences passed by military courts against fundamentalists to 62 in the past three years. Forty-two of them have been hanged.
The condemned men are members of the banned Gamaat el-Islamiya. The Islamic group has been waging a bloody campaign against the secular government of President Hosni Mubarak which has so far claimed 550 lives.
Mr Mahfouz was stabbed in the neck and seriously wounded last October by four of the defendants outside his Cairo home. The injury caused nerve damage that partly paralysed his right hand, preventing him from writing. The 83-year-old novelist writes all his works in long-hand Arabic script.
The attack caused an outrage in Egypt, where millions have seen films or television productions of the novelist's famous works including Midaq Alley, Khan el-Khalili, and the Cairo trilogy which depicts, in Dickensian style, the lives of ordinary people in the old city of Cairo.
His novel The Children of Gebelawi was mentioned several times during the trial. When it was first published in 1959 it was attacked by Muslim clergy as blasphemous.
By the mid-1980s Mr Mahfouz's name was among a list of 300 "apostates and blasphemous writers" compiled by fundamentalist groups.
The fundamentalists saw the awarding of Nobel prize to Mr Mahfouz in 1988 as further proof that he was "in the pocket of the Zionists and the infidel West". Sheikh Omar Abdel Rahman, the Egyptian preacher who is being tried in the United States on terrorcharges, issued a fatwa in 1989 calling for Mr Mahfouz's death.Reuse content