The actions of the Nice killer are totally understandable as jihad – not in spite of his history of apparently un-Muslim behaviour (alcohol, drugs, wife-beating, not attending a mosque, petty crime, active bi-sexuality), but because of his history.
It’s possible he was undertaking violent jihad – “fighting in Allah’s cause” – to earn redemption for his unbearable burden of earthly sins, which could otherwise condemn him to hell for eternity.
Mohamed Lahouaiej Bouhlel (note his first name) reportedly cried “Allahu Akbar” as he carried out his jihad attack. It’s said he recently took up mosque attendance. It could well be that he was depressed with guilt for his messed up earthly life, and fearful for the likely form of his after-life. So his Muslim culture drew him to the mosque to confirm that undertaking martyrdom through jihad would free him from eternal damnation. He may have been seeking assurance at the mosque that he had all the details of the routine right.
How does this work? The conventional Muslim belief is that the souls of the dead enter hell, with the saved passing through (or over) quickly and unimpeded, whereas those who have sinned undergo hellish torment for a time – for eternity for the worst sinners.
Martyrdom through violent jihad offers a direct route to paradise, bypassing Islam’s hell. The martyrs apparently believe that they will enter paradise instantly, having earned Allah’s redemption, when the first drop of their martyr’s blood is spilled and even while their earthly heart is still beating.
So, not only are non-devout Muslims plausible jihadists. For some, it’s their lifetime of dissolute non-observance that drives them to violent jihad.