Background: Use of masks and respirators for prevention of respiratory infectious disease transmission is not new, but has proven controversial, and even politically polarizing during the SARS-CoV-2 pandemic. In the Canadian province of Ontario, mask mandates were introduced by the 34 regional health authorities in an irregular fashion from June to September 2020, creating a quasi-experiment that can be used to evaluate impact of community mask mandates. Ontario SARS-CoV-2 case counts were strongly biased by testing focussed on long-term care facilities and healthcare workers. We developed a simple regression-based test-adjustment method that allowed us to adjust cases for undertesting by age and gender. We used this test-adjusted time series to evaluate mask mandate effectiveness. Methods: We evaluated the effect of masking using count-based regression models that allowed adjustment for age, sex, public health region and time trends with either reported (unadjusted) cases, or testing-adjusted case counts, as dependent variables. Mask mandates were assumed to take effect in the week after their introduction. Model based estimates of effectiveness were used to estimate the fraction of SARS-CoV-2 cases, severe outcomes, and costs, averted by mask mandates. Results: Models that used unadjusted cases as dependent variable identified protective effects of masking (effectiveness 15-42%), though effectiveness was variably statistically significant, depending on model choice. Mask effectiveness in models predicting test-adjusted case counts was substantially higher, ranging from 49% (44-53%) to 73% (48-86%) depending on model choice. Effectiveness was greater in women than men (P = 0.016), and in urban health units as compared to rural units (P < 0.001). The prevented fraction associated with mask mandates was 46% (41-51%), averting approximately 290,000 clinical cases, averting 3008 deaths and loss of 29,038 QALY. Costs averted represented $CDN 610 million in economic wealth. Conclusions: Lack of adjustment for SARS-CoV-2 undertesting in younger individuals and males generated biased estimates of infection risk and obscures the impact of public health preventive measures. After adjustment for under-testing, the effectiveness of mask mandates emerges as substantial, and robust regardless of model choice. Mask mandates saved substantial numbers of lives, and prevented economic costs, during the SARS-CoV-2 pandemic in Ontario, Canada.