Tripoli, Libya (CNN) -- From within Libya's most secure jail a new challenge to al Qaeda is emerging.
Leaders of one of the world's most effective jihadist organizations, the Libyan Islamic Fighting Group (LIFG), have written a new "code" for jihad. The LIFG says it now views the armed struggle it waged against Col. Moammar Gadhafi's regime for two decades as illegal under Islamic law.
The new code, a 417-page religious document entitled "Corrective Studies" is the result of more than two years of intense and secret talks between the leaders of the LIFG and Libyan security officials.
The code's most direct challenge to al Qaeda is this: "Jihad has ethics and morals because it is for God. That means it is forbidden to kill women, children, elderly people, priests, messengers, traders and the like. Betrayal is prohibited and it is vital to keep promises and treat prisoners of war in a good way. Standing by those ethics is what distinguishes Muslims' jihad from the wars of other nations."
The code has been circulated among some of the most respected religious scholars in the Middle East and has been given widespread backing. It is being debated by politicians in the U.S. and studied by western intelligence agencies.
In essence the new code for jihad is exactly what the West has been waiting for: a credible challenge from within jihadist ranks to al Qaeda's ideology.
While the code states that jihad is permissible if Muslim lands are invaded -- citing the cases of Afghanistan, Iraq and Palestine -- the guidelines it sets down for when and how jihad should be fought, and its insistence that civilians should not be targeted are a clear rebuke to the goals and tactics of bin Laden's terrorist network.
CNN was given exclusive access to the Abu Salim jail where the code was written to talk to the LIFG prisoners. The jail has a bloody reputation; in 1996 prison guards put down a revolt by allegedly killing more than 1,200 prisoners in less than 24 hours.
READ THE FULL STORY HERE AT CNN