One campus, in Maryland, temporarily canceled in-person classes after coronavirus infections surged past 60 cases two days in a row. The other, in Virginia, kept classrooms open even after it logged 229 cases in a single day.

The region’s flagship universities — the University of Maryland at College Park and the University of Virginia — have tracked an alarming uptick in the number of viral cases on campus. And each school has taken a different approach to curbing the spread, illustrating the tensions and uncertainty of trying to operate major research universities in the pandemic and preserve public health.

The communities surrounding these campuses are bracing themselves should the cases from campus make their way into grocery stores and onto public buses. In recent weeks, virus cases have been declining overall across the greater Washington region.

The surge at U-Va. spurred new safety restrictions, including a ban on in-person gatherings. But face-to-face classes remained in session, in part because officials have not seen incidents of viral transmission in the classroom, university leaders said last week.

The university since the beginning of the pandemic has tried to strike the right balance between aggressive monitoring and trusting students, Jim Ryan, U-Va.’s president, said at a virtual town hall Friday. Canceling face-to-face classes could have veered into the former.

“We knew that if we went too far or were too aggressive, it would feel like we were living in a totalitarian state and it contravened our foundational culture of trusting students to govern themselves,” Ryan said on Friday. “If we did nothing, on the other hand, it would seem like we were condoning violations or just looking the other way.”

But U-Va. — like U-Md. and hundreds of other universities — is not isolated. The city of Charlottesville is affected by what happens on campus.

Sena Magill, Charlottesville’s vice mayor, said Monday that the university’s neighbors are anxiously watching the caseload at U-Va. rise and fall. The campus recorded 737 cases last week, then just 39 cases over the weekend, data show. There are 840 active cases among students and employees.

“There’s definitely public fear right now. There’s a lot of people who are very worried,” Magill said. “We are supposed to be starting some in-person school at the beginning of March, and there’s a lot of parents that are very worried that these numbers will spread into the community and will either cause teachers and children to get sick or stop the ability for the in-person [schooling] to happen.”

The outbreak on campus cannot be traced to a single source, campus officials said. Instead, leaders have blamed widespread noncompliance with health guidance — from large gatherings to small, maskless dinners — for the surge of cases. But many on and off campus have blamed sororities and fraternities, which hosted in-person recruitment events the weekend before cases began to rise.

Photos and videos taken during the recent weekend of events have surfaced online.

“It was very disturbing to see,” Magill said about the photos. “That’s definitely sparked a lot of upset in the community, about what kind of enforcement is happening, especially within the Greek system.”

About three-quarters of cases reported by U-Va. are among students living off campus, but contact-tracing efforts have not linked any cases from the university to the wider Charlottesville community, Mitch Rosner, a professor and chair of the Department of Medicine, said on Friday.

“We’re all in the same neighborhoods and we all shop at the same grocery stores,” said Heather Hill, a Charlottesville city councilor. “When you have this kind of thing happening, it does definitely impact the rest of the community — and that can be really frustrating, for sure.”

Both Hill and Magill said they are comforted by restrictions being imposed by the university. And even before the campus banned in-person social meetups, it capped social gatherings at six people, which is more stringent than Charlottesville’s guidance that encourages groups to limit themselves to 10 people.

Jeff Richardson, county executive for Albemarle County, commended the university for testing students weekly — processing 5,000 tests on a daily basis — and maintaining regular communication with city and county officials.

Wes Bellamy, former Charlottesville vice mayor and current chair of Virginia State University’s political science department, said the recent outbreak is a reminder that people still need to be educated about the virus and how to prevent its spread.

“They’re 18-, 19-, 20-, 21-year-old young people who are going to indulge in a wide variety of things. They’re kids,” Bellamy said. “Where there’s concern, there’s also opportunity for growth.”

College Park responds

U-Md. has reported more than 240 new cases — including university-arranged viral tests and self-reported data from students and employees — since Wednesday. And the seven-day moving average of daily new cases topped 40 on Monday, a level not seen since September. There were 61 new cases Thursday and 62 Friday.

Alarmed at the rise, the university on Saturday ordered students who live on campus to “sequester in place” for at least a week and asked off-campus students to limit their movements as well. U-Md. also halted all in-person instruction for a week.

Even though there is little evidence that the virus spreads in college classrooms, U-Md. officials said they hoped to reduce the chances that infected and asymptomatic students might pass the virus among themselves if they were out and about on campus.

“We wanted to stop any additional spread,” said Patricia A. Perillo, vice president for student affairs. The university had not recorded such a fast and widespread rise in cases during the fall semester.

“We were watching in real time the numbers go up in ways we had not experienced,” Perillo said.

Exactly why the clusters erupted is unclear. Perillo said the university had seen no evidence of any recent “superspreader” events such as large parties. She noted that the university is testing students for the virus more frequently than it did in the fall. That might identify cases that otherwise would have gone undetected.

Another possibility, although not confirmed, is that a more infectious variant of the virus is on campus. But Perillo said officials are not waiting for confirmation of the presence of a variant. “All the steps we are taking are aligned with the assumption that it’s here,” she said.

For the communities in Prince George’s County that surround U-Md., the stakes are high as the university seeks to smother clusters of infection that have popped up all over the campus. Most of U-Md.’s 40,000 students live off campus. Only about 4,300 are in campus housing this semester.

“I do think the university’s doing the right thing by shutting down in-person instruction,” said Patrick L. Wojahn, mayor of College Park. “Any increase in cases is worrisome. We need to just keep monitoring it.”

If U-Md.’s caseloads keep rising, he said, more “drastic action might be necessary.”

Maryland State Sen. James C. Rosapepe (D-Prince George’s), who represents College Park, said he gives U-Md. high marks for fast intervention. “The university from the beginning has taken the danger of the pandemic to students and residents very seriously,” he said.