Background Incidence and prevalence of ulcerative colitis follow a north–south (latitudinal) gradient and increases northwards at the northern hemisphere or southwards at the southern hemisphere. The disease has increased during the last decades. The temporal trend has been explained by the hygiene hypothesis, but few parallel explanations exist for the spatial variability. Many factors are linked to latitude such as climate. Our purpose was to investigate the association between variables governing the climate and prospectively identified patients. Methods In this study, we used a subset of the population-based Cohort of Norway (n = 80412) where 370 prevalent cases of ulcerative colitis were identified through self-reported medication. The meteorological and climatic variables temperature, precipitation, and altitude were recorded from weather stations of the Norwegian Meteorological Institute. Summer temperature was used to capture environmental temperature. Results Summer temperature was significantly related to the prevalence of ulcerative colitis. For each one-degree increase in temperature the odds for ulcerative colitis decreased with about 9% (95% CI: 3%-15%). None of the other climatic factors were significantly associated to the risk of ulcerative colitis. Contextual variables did not change the association to the prevalence of ulcerative colitis. Conclusions The present results show that the prevalence of ulcerative colitis is associated to summer temperature. Our speculation is that summer temperature works as an instrumental variable for the effect of microbial species richness on the development of ulcerative colitis. Environmental temperature is one of the main forces governing microbial species richness and the microbial composition of the commensal gut flora is known to be an important part in the process leading to ulcerative colitis.