The theological justification for al Qaeda's wholesale slaughter of civilians was provided by Sayyid Imam al-Sharif, also known as Dr. Fadl, one of the founding fathers of al Qaeda. Because the murder of innocents is forbidden in Islam and the murder of Muslims in particular, Ayman al-Zawahiri and Osama bin Laden required some sort of theological framework for justifying terrorism. This was provided by al-Sharif, who essentially argued in his book, "The Compendium of the Pursuit of Divine Knowledge," that apostates could be murdered, and that approach, takfir (which has come to be known as takfirism) allowed al Qaeda to, for all intents and purposes, kill anyone they wanted without violating the laws of Islam by declaring them to be apostates. In other words, Dr. Fadl helped provided a theological justification for something that everyone involved knew was wrong.
The legal memos justifying torture aren't very different in terms of reasoning--it's clear that John Yoo and his cohorts in the Office of Legal Counsel saw their job not as binding the president to the rule of law, but to declare legal any tactic that the executive branch believed necessary to fight terrorism. They worked backwards from this conclusion, and ethics officials at the Department of Justice, we now know, decided that they they had violated professional standards in doing so. Whereas al-Zawahiri and bin Laden turned to al-Sharif for a method to circumvent the plain language of the Koran, Bush and Cheney went to Yoo and Jay Bybee to circumvent the plain language of the law. Most Islamic scholars, just like most legal experts, reject their respective reasoning as unsound.
It's worth reading the rest. I don't subscribe to the more or less optimistic conclusion Serwer comes to, but I'm very inherently cynical about this sort of thing. It would certainly be nice if he were proved right.