Three weeks before the fall semester starts at the University of Maryland, the school’s president announced that classes would begin online.

The state flagship school had planned to hold in-person classes in the fall. But Darryll J. Pines, the new president of U-Md., announced Monday that undergraduate classes would be held virtually until mid-September because of the prevalence of the coronavirus in Maryland and Prince George’s County, where the College Park campus is located.

The most recent seven-day positivity rate in the county is the highest in the state at 5.4 percent, Pines said in a message to the campus.

The president asked that all students — those living on and off campus — stay in their homes as much as possible in early September.

“It is our fervent hope and expectation that we will resume in-person and blended instruction on September 14,” Pines wrote. “At the same time, the health of our university community and slowing the spread of COVID-19 must remain our continuing and unwavering priorities.”

Graduate instruction and research activities are expected to continue as planned.

Campus move-in will proceed as planned this month, but with fewer students than normal. Officials are projecting occupancy of less than 45 percent; last fall, more than 11,000 students lived on campus, university data show.

In addition to getting tested before coming to campus, per guidelines set by the state’s public higher education system that oversees College Park and 11 other institutions, Pines told students they will also be required to be tested after their arrival. The university is offering free testing from Aug. 17 through the end of the month for members of the campus community, Pines said.

Those who get tested will be asked to stay in their homes or on-campus residences until a negative result is produced, Pines said. If an individual tests positive for the coronavirus, they will be required to self-isolate for 14 days.

“Testing everyone who is physically present on our campus is critical to our understanding of the prevalence of the coronavirus in our community,” Pines said.

Pines called on the community to comply with safety guidelines — including frequent handwashing, mask usage and social distancing — and said the resumption of in-person classes will be partially dependent on whether students can adhere to those standards. All students must complete an online coronavirus training before the semester starts and sign a pledge, agreeing to follow health and safety protocols, Pines said.

Those protocols include guidance to avoid crowded parties.

“The county has the authority to charge anyone who hosts or attends a large party or gathering with a misdemeanor that carries a maximum penalty of up to one year in jail, a $5,000 fine, or both,” Pines wrote.

The university is working with businesses in the city of College Park to ensure safety measures are in place at local bars, restaurants and rental housing units, Pines said. Students, faculty and staff who skirt public health guidance can face disciplinary action.

The school is one of many locally and nationally to pivot abruptly to a new reopening plan for undergraduates amid the pandemic.

Last week, Johns Hopkins University in Baltimore announced a shift to virtual instruction for the fall and urged students to stay home. Howard University made a similar announcement and canceled on-campus housing for most students.

Pines acknowledged that many students want to know whether they should return to campus and that it was a complex question.

“Instead, I urge every student to have a thoughtful conversation with their families and loved ones and decide what is right for them,” Pines said. “Regardless if students take up residence this fall or not, we are here to provide a high-quality educational experience.”