Programmed death-ligand 1 (PD-L1) and ICOS-L (also referred to as B7 homolog 1 and 2, respectively) modulate the immune inflammatory response. The aim of the present study was to examine the expression levels of these inflammatory mediators in two groups of patients with an Helicobacter pylori (H. pylori) infection; patients with and without gastric cancer. The association between bacterial virulence factors, CagA and VacA, was also examined, as well as their correlation with the inflammatory profile. Endoscopy analysis indicated that 18 patients suffered from cancer and 28 patients suffered from other gastric pathologies. PCR and reverse transcription-quantitative PCR were used to analyze gastric biopsies and determine the expression levels of the inflammatory modulators PD-L1 and ICOS-L, transcription factors, cytokines and other genes associated with inflammation and pathogenicity. All 46 patients were determined positive for markers of H. pylori. Patients with stomach cancer had lower levels of ICOS-L (P<0.05) and GATA3 (P<0.01), a negative correlation between CagA and IL-17 (P<0.05), a positive correlation between CagA and IL-10 (P<0.05), a negative correlation between vacA-m1 and retinoid orphan receptor γt (RORγt) (P<0.001), and a positive correlation between RORγt and ICOS-L (P<0.001). The reduced levels of ICOS-L and GATA3 along with the negative correlation between CagA and IL-17, and between vacA-m1 and RORγt were all associated with an increased risk of gastric cancer in the present cohort.