Thousands of Arizona teachers who walked out of schools a week ago to protest low pay and slumping education funding are slated to head back to class Friday, marking an end to one of the biggest teacher protests in a year that has seen a spate of job actions.

The state is giving teachers a 20 percent raise by 2020 and investing an additional $138 million in schools — an outcome that only partially met educators’ demands.

The end of the walkout, which shut down schools for hundreds of thousands of students, comes after a dramatic week that was capped when lawmakers worked through the night while teachers kept vigil. Legislators finally passed the budget at 5:30 a.m. Thursday, after 13 hours of debate, the Arizona Republic reported. Gov. Doug Ducey (R) signed the budget at 6:10 a.m.

Arizona is one of five states that have experienced school closures this year because of teacher walkouts, starting in West Virginia, where teachers shut down schools statewide for nine days before winning a raise.

Oklahoma teachers also won a raise and an increase in education funding, and Kentucky teachers successfully pushed back against pension changes that could have significantly reduced benefits. Thousands of Colorado teachers rallied at the state capitol Monday. The movement may continue: Teachers and school support workers in a small southern Colorado community have voted to strike, Chalkbeat reported.

As in other states, the movement in Arizona arose organically, with teachers coordinating through Twitter hashtags and Facebook pages. The group’s leaders urged their colleagues across the state to wear red T-shirts in a demonstration they called “Wear #RedforEd,” giving the movement its name: #RedforEd.

Educators in Phoenix and Denver rallied for more education funding at their state capitols on April 26, as part of a wave of teacher protests. (The Washington Post)

Like other states that have seen teacher uprisings, Arizona’s schools have lost a significant amount of state funding since the recession, when states were forced to cut budgets across the board. The state did little to restore funding to schools after the economy recovered. Arizona enacted a corporate tax cut that continued to deplete revenue.

When adjusted for inflation, Arizona cut total state per-pupil funding by 37 percent between 2008 and 2015, more than any other state, according to the left-leaning Center on Budget and Policy Priorities. That has led to relatively low teacher salaries, crumbling school buildings and the elimination of free full-day kindergarten in some districts. In 2016, Arizona ranked 43rd in average teacher salaries, according to a study by the National Education Association, the largest teachers union. Teacher shortages have led the state to waive education requirements for teaching candidates. In some cases, even people without college degrees can serve as substitutes.

The spending plan does not fulfill all the demands of the protesting teachers, but they made good on a pledge to end the walkout when lawmakers passed a budget. Teachers had called for an immediate 20 percent raise. They also wanted the state to fully restore funding cuts made in the past decade, which would have cost more than $1 billion.

In a joint statement, Arizona Education Association President Joe Thomas and National Education Association President Lily Eskelsen García said the walkout was the beginning of a movement to press the state to restore budget cuts.

“We will return to our schools, classrooms, and students knowing that we have achieved something truly historic,” they said. “We should take pride in what we have accomplished, and in the movement that we have created together.”