Observational studies have discovered a contradictory phenomenon between Helicobacter pylori (H. pylori) infection and inflammatory bowel disease (IBD). The study aimed to confirm the causal association between H. pylori and IBD, including ulcerative colitis (UC) and Crohn's disease (CD). We conducted a Mendelian randomization (MR) study with two sample Genome-Wide Association Studies (GWAS) to determine whether there is a causal relationship between H. pylori infection and IBD, as well as the possible pathogenic factors that may be involved. The reliability of the main MR assumptions was examined through a series of sensitivity analyses. Two genetic variants (SNPs) previously identified were employed as instrumental variables (IVs) for H. pylori infection. GWAS data for IBD, UC, and CD were obtained from the recent DF10 release10 of the FinnGen study. Our findings indicated a significant association between H. pylori seropositivity and an increased risk of IBD and UC (IBD: OR: 1.16, 95% CI, 1.03-1.31, P < 0.05; UC: OR: 1.22, 95% CI, 1.08-1.37, P < 0.001) while no causal relationship with CD (P > 0.05). Analysis of the main virulence pathogenic factors revealed a causal relationship between cytotoxin-associated protein A (CagA) and IBD and UC (IBD: OR: 1. 06, 95% CI, 1.001-1.11, P < 0.05; UC: OR: 1.07, 95% CI, 1.004-1.14, P < 0.05), while no correlation was found for vacuolar cytotoxin A (VacA) (P > 0.05). After applying the False Discovery Rate (FDR) correction, the causal relationship between CagA and the risk of IBD or UC was no longer statistically significant. This study suggests a potential causal relationship between H. pylori infection and IBD, particularly UC. The effect may be more pronounced in individuals with previous H. pylori infections.