Abstract Background Because whether hepatitis B virus infection increases the risk of type 2 diabetes mellitus has been a controversial topic, pair‐wise and network meta‐analyses of published literature were carried out to accurately evaluate the association between different phases of hepatitis B virus infection and the risk of type 2 diabetes mellitus. Methods A comprehensive literature retrieval was conducted from the PubMed, Embase, Cochrane Library and Chinese Database to identify epidemiological studies on the association between hepatitis B virus infection and the risk of type 2 diabetes mellitus that were published from 1999 to 2015. A pair‐wise meta‐analysis of direct evidence was performed to estimate the pooled odds ratios and 95% confidence intervals. A network meta‐analysis was conducted, including the construction of a network plot, inconsistency plot, predictive interval plot, comparison‐adjusted funnel plot and rank diagram, to graphically link the direct and indirect comparisons between different hepatitis B virus infective phases. Results Eighteen publications (n=113 639) describing 32 studies were included in this meta‐analysis. In the pair‐wise meta‐analysis, the pooled odds ratio for type 2 diabetes mellitus in chronic hepatitis B cirrhosis patients was 1.76 (95% confidence interval: 1.44‐2.14) when compared with non‐cirrhotic chronic hepatitis B patients. In the network meta‐analysis, six comparisons of four hepatitis B virus infectious states indicated the following descending order for the risk of type 2 diabetes mellitus: hepatitis B cirrhosis patients, non‐cirrhotic chronic hepatitis B patients, hepatitis B virus carriers and non‐hepatitis B virus controls. Conclusion This study suggests that hepatitis B virus infection is not an independent risk factor for type 2 diabetes mellitus, but the development of cirrhosis may increase the incidence of type 2 diabetes mellitus cirrhosis.