Background and Aims: Tumor microenvironment plays an essential role in cancer development and progression. Cancer immunotherapy has become a promising approach for the treatment of hepatocellular carcinoma (HCC). We aimed to analyze the HCC immune microenvironment characteristics to identify immune-related genetic changes. Methods: Key immune-relevant genes (KIRGs) were obtained through integrating the differentially expressed genes of The Cancer Genome Atlas, immune genes from the Immunology Database and Analysis Portal, and immune differentially expressed genes determined by single-sample gene set enrichment analysis scores. Cox regression analysis was performed to mine therapeutic target genes. A regulatory network based on KIRGs, transcription factors, and immune-related long non-coding RNAs (IRLncRNAs) was also generated. The outcomes of risk score model were validated in a testing cohort and in clinical samples using tissue immunohistochemistry staining. Correlation analysis between risk score and immune checkpoint genes and immune cell infiltration were investigated. Results: In total, we identified 21 KIRGs, including programmed cell death-1 (PD-1) and cytotoxic T-lymphocyte associated protein 4 (CTLA4), and found IKBKE, IL2RG, EDNRA, and IGHA1 may be equally important to PD-1 or CTLA4. Meanwhile, KIRGs, various transcription factors, and IRLncRNAs were integrated to reveal that the NRF1-AC127024.5-IKBKE axis might be involved in tumor immunity regulation. Furthermore, the immune-related risk score model was established according to KIRGs and key IRLncRNAs, and verified more obvious discriminating power in the testing cohort. Correlation analysis indicated TNFSF4 , LGALS9 , KIAA1429 , IDO2, and CD276 were closely related to the risk score, and CD4 T cells, macrophages, and neutrophils were the primary immune infiltration cell types. Conclusions: Our results highlight the importance of immune genes in the HCC microenvironment and further unravel the underlying molecular mechanisms in the development of HCC.