MARTINSBURG, W.Va. — Before the strike came to West Virginia, and classrooms in all 55 counties sat empty, and picket lines formed near schools, there was Melanie Slack and her class at Burke Street Elementary. The first-graders had been learning about the moon before the stoppage stalled all of that.

“We want to be in our classroom,” Slack said this week. “I love my kids. We don’t want them suffering . . . but sometimes, you’ve got to stand for something.”

Slack and her fellow teachers in West Virginia did take a stand, raising their voices about salary and benefits in a work action that engulfed the state. Hours after she spoke at the Burke Street school, Slack and other educators here learned the strike might be over. On Tuesday night, West Virginia’s governor, Jim Justice, announced a pact between the state and educators.

West Virginia is one of the nation’s poorest states, and its teachers are among the most poorly paid, ranking 48th in the United States in 2016, according to the National Education Association. The strike has helped to underscore the depth of that need, like when a 9-year-old girl came into the Burke Street school on Tuesday.

Students and families, some of whom rely on schools to feed their children as well as teach them, could pick up food at Burke Street during the stoppage — applesauce and milk, peanut butter and jelly sandwiches and chips. So here was the third-grader in a green sweatshirt. Her name was Serenity, said her mother, Brandy Gilbert, spelled like the prayer.

“I was just actually telling a few of the teachers outside that some of the kids should be out there with them,” Gilbert, 37, said. “Because it not only affects the teachers, it’s affecting the students as well.”

Serenity Gilbert is an honor roll student at Burke Street, where she enjoys math and science, but likes recess, too. The school has done so much to help the family, which is homeless and on a limited income, Brandy Gilbert said. These teachers, she said, deserved what they were asking for.

“It’s hard, because with her not being in school, it’s difficult for us to go and do what needs to be done,” said Gilbert, whose family picked up lunches at the school during the strike. “Right now, we’re in a hotel. So we’re having to find resources and it’s hard to do so when you’re having to lug around your child, too, when you’re so used to doing stuff within school hours.”

Not every situation had to be so dire to understand the impact of the strike in Berkeley County — where parents and other caregivers were sorting through what to do as the strike gripped this state, which has more than 277,000 public school students. At a local Boys & Girls Club, a volunteer, Shelley O’Neil, said she took one of her 10-year-old twins to her college courses. O’Neil, 42, said she had spotted other kids on campus, and her professors had been accommodating.

“It is a struggle,” O’Neil said. “But I understand it. And I support it.”

Mindy Leyh, a 27-year-old single mother, said she has four children, three of whom are school-age. Leyh is taking classes to get her GED, but with schools closed, she faced difficult choices. She had to leave her GED classes early Tuesday because she did not have a babysitter. On another day, she wasn’t able to go at all.

During the strike, Leyh had to pay someone to watch her children, but that wasn’t something she could regularly afford.

“It feels kind of stressful,” Leyh said. “Kind of irritated sometimes. I don’t have the money. If I don’t go to school, there’s consequences. And if I try to find a babysitter, there’s consequences. Because nobody’s going to do it for free for me.”

Dana Melbourne, 58, had also stopped by Burke Street with two grandchildren in tow. Both of those children — Naomi Romero, 7, and Elijah Miller, 8 — attend the school. Melbourne had been watching Naomi and Elijah during the work stoppage.

“We’re just waiting on the teachers, supporting the teachers,” Melbourne said. “I mean, it doesn’t matter to me that school’s out and the kids aren’t learning anything. They’ll learn, once the teachers come back.”

Even after Justice announced an agreement on a 3 percent raise for all state employees, with an additional 2 percent increase for those who work in education, there was uncertainty among educators. Some teachers were still worried about health care, which had been a major concern. What if the whole agreement fell apart? Would parents keep supporting teachers then?

“I guess it’s a good starting place,” said Lauren Funderburk, a teacher in Berkeley County. “Even if we didn’t get everything that was expected right now, it’s out there. We’re working toward it.”

Steven Paine, West Virginia’s superintendent of schools, issued a statement earlier Wednesday saying he expected all public schools in the state to be in session on Thursday. But by Wednesday night, cancellations were rampant. The reasoning behind those closures remained unclear. Representatives of the state’s Department of Education did not immediately return emails seeking clarification.

Reached by phone after the agreement was announced, Slack, the teacher from Burke Street, said educators were nervous, concerned they were relying on a promise, not something formally approved.

“I worry that we did this,” Slack said, “and now it’s going to be for nothing.”