Thousands of North Carolina teachers descended Wednesday on the statehouse in Raleigh to protest a growing funding crisis that has left schools with dwindling supplies of textbooks, ballooning class sizes, a dearth of qualified teachers and educator pay that lags far behind the national average.

The exodus of teachers from their classrooms meant that officials in about 40 North Carolina school districts — including some of the state’s largest — decided to close schools. An estimated 1 million children — most of the state’s public school students — were out of class Wednesday.

The state is the latest to see teachers leave schools en masse to confront state lawmakers, hoping to reverse years of budget cuts. Teachers in five other states have rallied at state capitols to press for school funding, beginning in West Virginia, where teachers shuttered schools statewide for nine days before getting a raise.

The North Carolina Association of Educators, a union, estimated more than 20,000 teachers marched to the state Capitol, some streaming inside. Many wore red, the color that has become ubiquitous at teacher’s marches. They carried signs from the serious — “Put public education first” — to the hilarious — “There’s almost as many people here as in my classroom.”

Legions of teachers then gathered outside on the lawn, and state lawmakers who supported their cause held impromptu meetings. Teachers were scheduled to hold a “Rally for Respect” in the afternoon, where Democratic Gov. Roy Cooper (D) was expected to speak.

“It’s an epic day in North Carolina,” said Mark Jewell, president of the North Carolina Association of Educators.

North Carolina spent $9,948 per student in 2017, according to a report from the National Education Association, putting it at 38th among states. The average teacher salary this year is estimated at $50,861, nearly $10,000 lower than the national average. The state has given raises but has cut pay for longtime teachers and for teachers who receive master’s degrees.

As in other states where teachers are battling shrinking school budgets, North Carolina’s GOP-led legislature has cut income and corporate taxes in recent years, moves that put pressure on state revenue. Accounting for inflation, state per-student spending in North Carolina has fallen 8 percent over the past decade, according to the left-leaning Center on Budget and Policy Priorities.

Jewell said the state is poised to cut taxes again this year and will lose an estimated $3.6 billion in revenue, meaning schools are likely to see more cuts.

The movement, he said, “is the culmination of years of starving our public school system,” he said Tuesday.

The rally is intended to be a kickoff for a campaign to get more candidates who support public education elected to the statehouse in November, when every seat in the state House and Senate is up for grabs. The GOP holds enough seats that lawmakers can override a veto from the Democratic governor. But the state recently redrew legislative districts, meaning some seats that were safely in the hands of Republicans are competitive.

GOP lawmakers disputed the assertion that they have not invested sufficiently in public schools, highlighting raises they have given to teachers. In a news release, Rep. Tim Moore (R), speaker of the House, and Sen. Phil Berger (R), president pro-tem of the Senate, said teachers will receive their fifth consecutive pay raise in the coming year.

“The numbers speak for themselves — and we’re glad to have the opportunity to share North Carolina’s success story and set the record straight,” they said in a statement.

The average teacher salary in 2018-2019 will rise to $53,600, meaning teachers will get an average of about $3,000 more in their paychecks. That salary puts them closer to the national average.

Jasmine Lauer, who teaches language arts and social studies at a Raleigh middle school, said she is rallying on behalf of her students, who she says have suffered because of cuts to classrooms. She has seen class sizes rise and textbooks fall apart. Once, while teaching a high school class of refugees who struggled with English, she decided to purchase 35 textbooks for English-language learners. She found some used but sometimes paid up to $100 for each book, purchasing one a month for nearly three years.

“We’re being asked every day to do way more with way less resources,” Lauer said.