Mr. Kadhimi, who addressed the nation on television shortly after the attack, said he wasn’t hurt. The attack followed threats against Mr. Kadhimi from an Iran-backed militia leader, though the armed groups denied responsibility and no one immediately claimed credit.