Early detection and treatment are critical for improving the outcome of patients with cancer1. Understanding the largely uncharted biology of carcinogenesis requires deciphering molecular processes in premalignant lesions, and revealing the determinants of the intralesional immune reaction during cancer development. The adaptive immune response within tumours has previously been shown to be strongest at the earliest stage of carcinoma2,3. Here we show that immune activation and immune escape occur before tumour invasion, and reveal the relevant immune biomarkers of the pre-invasive stages of carcinogenesis in the lung. We used gene-expression profiling and multispectral imaging to analyse a dataset of 9 morphological stages of the development of lung squamous cell carcinoma, which includes 122 well-annotated biopsies from 77 patients. We identified evolutionary trajectories of cancer and immune pathways that comprise (1) a linear increase in proliferation and DNA repair from normal to cancerous tissue; (2) a transitory increase of metabolism and early immune sensing, through the activation of resident immune cells, in low-grade pre-invasive lesions; (3) the activation of immune responses and immune escape through immune checkpoints and suppressive interleukins from high-grade pre-invasive lesions; and, ultimately, (4) the activation of the epithelial-mesenchymal transition in the invasive stage of cancer. We propose that carcinogenesis in the lung involves a dynamic co-evolution of pre-invasive bronchial cells and the immune response. These findings highlight the need to develop immune biomarkers for early detection as well as immunotherapy-based chemopreventive approaches for individuals who are at high risk of developing lung cancer.