Background. Helicobacter pylori infection has long been suspected to increase the risk of thyroid diseases but evidence from literature is conflicting. In a cohort of patients from Northern Sardinia, Italy, who underwent upper endoscopy, we investigated the association between current and long-lasting Helicobacter pylori infection and thyroid disease, both autoimmune and non-autoimmune, by adjusting for potential confounds. Methods. By using multivariable logistic regression we analyzed a cohort of 8490 adults aged 6–93 years: 730 were diagnosed with autoimmune thyroid disease (AITD) and 448 with nonautoimmune thyroid diseases. Results. We found a significant association between H. pylori long-lasting infection and AITD independently of age, sex, body mass index, smoke, hypertension and dyslipidemia (OR 1.42; 95%CI 1.20‒1.66) while the opposite was found regarding current infection (OR 0.75; 95%CI 0.63‒0.89). Current infection was not significantly associated to non-autoimmune thyroiditis. Conclusions. H. pylori infection is an independent risk factor for AITD in the population of Northern Sardinia, therefore it is advisable to eradicate the pathogen in subjects at risk of AITD.