Hepatocellular carcinoma (HCC) is the fifth most common cancer and the second most common cause of cancer-related deaths worldwide. As immune response failure is the main factor in the occurrence and poor prognosis of HCC, our study aimed to develop an immune-associated molecular occurrence and prognosis predictor (IMOPP) of HCC. To that end, we discovered a 4-gene immune-associated gene signature: C-C motif chemokine ligand 14 (CCL14), kallikrein B1 (KLKB1), vasoactive intestinal peptide receptor 1 (VIPR1), and cluster of differentiation 4 (CD4). When tested on three cohorts as an immune-associated molecular occurrence predictor (IMOP), it had high sensitivity, specificity, and area under the receiver operating characteristics curve. When tested as an immune-associated molecular prognosis predictor (IMPP), it stratified the HCC prognosis for overall survival (Kaplan-Meier analysis, log rank P = 0.0016; Cox regression, HR = 1.832, 95% CI = 1.173-2.859, P = 0.008) and disease-free survival (Kaplan-Meier analysis, log rank P = 0.0227). IMPP also significantly correlated with the clinicopathological characteristics of HCC; integrating it with clinicopathological characteristics improved the accuracy of a nomogram for overall survival prediction (C-index: 0.7097 vs. 0.6631). In HCC tumor microenviroments, the proportion of CD8 + T cells significantly differed between IMOP-stratified groups. We conclude that IMOPP can potentially predict the occurrence of HCC in high-risk populations and improve prognostic accuracy by providing new biomarkers for risk stratification. In addition, we believe that the IMOP mechanism may be related to its effect on the proportion of CD8 + T cells in tumor-infiltrating lymphocytes.