In a race closely watched by education activists, Wisconsin education chief Tony Evers ousted Republican Gov. Scott Walker in a state President Trump carried in 2016, a win that activists viewed as evidence of the enduring might of teacher unions.

Tuesday’s midterm elections were regarded as a test of the strength of educator activism. They followed a landmark Supreme Court decision on unions and walkouts that galvanized teachers. Unprecedented numbers of educators ran for public office this year, and many more volunteered for candidates who pledged to increase education funding.

Voters ranked education as one of their top issues in Arizona and Wisconsin. Nationally, education was mentioned in one-third of all television ads in governors’ races, according to the Wesleyan Media Project, which tracks campaign ads. Only health care garnered more mentions.

But the final grade for teachers — their success as candidates and their ability to influence races — was mixed.

After the Supreme Court in June sided with a man challenging unions’ ability to collect fees, many anticipated a steep drop-off in union membership and a correlating decline in their political power.

Lily Eskelsen García, president of the National Education Association, said she does not have firm membership numbers for her group, the nation’s largest union. But the number of members who volunteered on political campaigns through the union more than doubled from 2016, she said, a spike she attributes in part to the teacher movement that clad itself in red and assumed the motto #redfored.

“That #redfored wave that started in West Virginia and moved across the country . . . changed the way people talked about public schools,” García said, adding that it raised public awareness of the decrepit condition of some classrooms.

In deep-red states, Republican governors kept their seats as expected, fending off challenges from Democrats backed by teacher activists. Several teachers energized by walkouts decided to run for office — but many of them, political newcomers, lost.

In Oklahoma, the GOP held on to the governor’s office despite opposition from teacher activists who had sought salary increases and enhanced investments in classrooms. Several teachers inspired by the walkouts lost bids for statehouse seats.

Even if they didn’t win seats, teacher activists left a mark on the Oklahoma legislature. In the spring, teachers shut down schools to protest low pay and school funding cuts. They persuaded lawmakers to give them raises and to make a historic investment in public schools — underwritten by a tax on the oil and gas industry.

They exacted revenge on Republican lawmakers who dared to oppose them: In primaries and runoff elections leading up to Tuesday, education activists helped unseat eight Republican incumbents who voted against the measure that put more money into schools and raised teacher pay. Some of those vanquished lawmakers will be replaced by Republicans who pledged to side with the teachers in the next funding fight.

Alberto Morejon, the middle-school social studies teacher who helped organize the statewide teacher walkout, wrote Tuesday night to a walkout Facebook group that “there is no doubt that the results of tonight’s major race was disappointing. However, what we’ve accomplished overall is nothing short of history,” Morejon wrote.

“Many seats in both the House, Senate, and various other positions are now filled with Pro Public Education candidates.”

Arizona Gov. Doug Ducey (R) handily fended off Democratic challenger David Garcia, an education professor favored by many teachers. But voters rejected a measure Ducey championed that would have made nearly every student eligible for private-school vouchers.

Voters in several states weighed in on measures that will affect public schools. Coloradans voted down an initiative to tax affluent residents to fund schools. Nearly three-quarters of Alabama voters supported a measure to allow the Ten Commandments to be posted in public places, including at schools.

School shooting survivors from Parkland, Fla., who campaigned for stronger gun restrictions, went to bed disheartened as Republican Rick DeSantis, endorsed by the National Rifle Association, narrowly edged out his Democratic challenger in the governor’s race.

Still, teacher unions and education activists celebrated notable victories.

In Kansas, many teachers marked the ascension of Democratic lawmaker Laura Kelly to the governor’s office. Kelly had fought to get her colleagues to comply with a state Supreme Court decision to increase school funding, and she campaigned on raising education spending. It appeared to be a winning strategy as she defeated far-right candidate Kris Kobach, whose extremist views cost him the support of Republican colleagues.

Democratic teachers and education leaders were heartened by the victory of Jahana Hayes, the 2016 National Teacher of the Year, who is slated to become the first black congresswoman from Connecticut. She faced long odds, first by beating in the primary the candidate endorsed by the Democratic establishment. It was a position she’s accustomed to: She was raised in public housing by a mother addicted to drugs, and she became pregnant at 17, eventually making it to college with the help of high school teachers.

In her victory speech Tuesday, Hayes evoked the nickname for her hometown of Waterbury, Conn., while addressing skeptics who said the former history teacher was not cut out for the job.

“Not only am I made for this,” Hayes said, “I’m Brass City made for this.”

Laura Meckler contributed to this report.