HARRISBURG, Pa. (AP) — Pandemic-related shutdowns in Pennsylvania, the nation’s No. 2 commercial gambling state, helped knock casino revenue down by 18%, state regulators reported Thursday, and it would have been much worse without the advent of online gambling and sports betting.

Revenue from regulated gambling in Pennsylvania shrank to $2.7 billion in the just-finished fiscal year, down from a new record high above $3.3 billion a year ago, according to the Pennsylvania Gaming Control Board.

Revenue from slot-machine gambling was down by $680 million and table games were down by about $240 million, both nearly 30%. But online gambling contributed $240 million and sports betting brought in $114 million in the first full year for both in casinos’ portfolios in Pennsylvania.

The state’s 12 operating casinos spent much of the spring shut down, while online gambling went on. Online sports betting also continued, but was hobbled by the cancellation of sporting events during the pandemic.

Pennsylvania legalized both as part of an aggressive gambling expansion in 2017.

Pennsylvania was the nation’s No. 2 state for commercial casino revenue in 2019, behind Nevada, according to American Gaming Association figures. It was No. 1 in tax revenue from casino gambling last year, but the gaming board estimates that the state’s take will shrink to $1.1 billion from $1.4 billion in the last fiscal year.

(Copyright 2020 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed without permission.)