Loudoun County officials have closed the county’s school system through the end of the week and have canceled midterm exams, citing continuing traffic-safety issues after a snowstorm passed through the region.

Loudoun school officials canceled Thursday and Friday classes because roads across the county — a diverse territory with suburban communities in the east and rural areas in the west — remained icy and dangerous after Tuesday’s storm, schools spokesman Wayde Byard said.

“The roads are bad, and sidewalks are too,” said Byard, who noted that the district has 20,000 students who walk to school.

The decision to close school for an entire week came as a shock to parents, teachers and students, but several people said that roads remain treacherous and that safety should be the top priority.

“Yes, I’m frustrated I can’t give my midterm, but you can’t fight Mother Nature,” said Lisa Levy, who spent hours preparing an exam on the John Steinbeck novella “Of Mice and Men” for a ninth-grade honors English class at Loudoun County High School. “Even though I put in all that time and I’m ready to give the test, I’ll just make my final exam cumulative. I wouldn’t want to read a newspaper article about a bus going off the road into a ditch.”

Early in the month, more than 20 Loudoun school buses struggled to traverse icy roads after a record cold snap sent temperatures plunging into the single digits. School officials had decided to open that day on a two-hour delay, but the buses were en route before the ice fully melted, Byard said. It was a situation that school officials did not want to repeat this week, he said.

“Our priority is safety, and having a two-hour delay wasn’t going to make any difference,” he said. “And everything is supposed to refreeze.”

Penny Merritt, a Loudoun school bus driver, said conditions are icy in western areas of the county, especially on twisty and hilly roads around Middleburg.

“It’s very, very dangerous even when the roads are dry,” said Merritt, who drives 40 children in a yellow Thomas Built C2. “All the buses would have trouble getting around and safely getting children to and from school.”

Schools in Montgomery and Prince George’s counties are scheduled to start two hours late Thursday, and officials say icy conditions could affect tens of thousands of students who walk to school.

Montgomery schools spokesman Dana Tofig said officials wanted to ensure that “students who walk to school are doing so when it’s light out.”

Kevin M. Maxwell, chief executive of Prince George’s schools, also said he wanted students to walk in daylight. In addition, he mentioned giving maintenance workers time to check boilers and water pipes to make sure that heating and water systems are operating properly.

Schools in Fairfax and Prince William counties announced that they would remain closed Thursday, and schools in Alexandria and Arlington County planned to open two hours late. Public schools were scheduled to open on time in the District.

Byard said that the decision to cancel middle and high school midterms was unusual and that weather had prompted a cancellation of the exams just two or three times before. The exams had been scheduled to begin Tuesday; the school system’s second semester will now begin Monday.

Loudoun students who want to take midterms to improve their grades will have an opportunity at a later date. “If you need it to improve your grade, you can take it,” Byard said. “Otherwise, you don’t have to.”

He said the school administration was taking heat from parents on its Facebook page.

“There are people who are a little upset because their children studied, and, you know, we understand that,” Byard said. He added, “From an instructional standpoint, this was the best decision to make.”

Jill Weiss, the mother of a 14-year-old freshman at Tuscarora High School, said her daughter was on Twitter with her friends, rejoicing.

“I can tell you I have a very happy child who doesn’t have to take her exams,” Weiss said. “With school being closed even up through Thursday, it probably wouldn’t have been possible to get through material on time before the exams.”

Donna St. George and Ovetta Wiggins contributed to this report.