A "serious blunder" by officials meant they failed to disrupt a murder plot against an imam by Islamic State (IS) extremists, an inquiry has found.