OBJECTIVE: Gastric cancer is a harmful disease, the comorbidity mechanism and causality relationship between this disease and other diseases are worth studying. METHODS: Using a two-sample Mendelian Randomization method, this study revealed the potential causal effect of atrial fibrillation (AF) on gastric cancer (GC) risk by constructing a genetic instrument containing 136 AF associated SNPs. Subsequently, analysis identifies 62 AF-GC co-associated genes and constructs a protein-protein interaction network of key genes. High-throughput sequencing data were further used to analyze the association between the two and their impact on the survival outcome of gastric cancer. RESULTS: The results showed that AF was negatively associated with gastric cancer, and further analysis revealed that this relationship was independent of GC risk factors such as chronic gastritis, CONCLUSION: This study provides new insights into the association between AF and GC and offers novel clues for understanding its impact on the pathogenesis and therapeutic strategies of GC.