A rural community college became the site of America’s latest mass shooting on Thursday as a lone gunman burst into classrooms during the school day and mowed down terrified students before being shot dead in a firefight with police, authorities said.

Officials said nine people were killed, plus the gunman, and seven injured during the traumatic events at Umpqua Community College, about three hours south of Portland.

A federal law enforcement official identified the gunman as 26-year-old Chris Harper Mercer of nearby Winchester, Ore. On Thursday evening, Gloria Buhring, a resident of Winchester, said that her apartment complex was swarmed by police and that residents who left their homes earlier in the day could not return because much of the area was sealed off by police tape.

Mercer was described as wearing a dark shirt and jeans and spewing bullets from what appeared to be three pistols and possibly a semiautomatic rifle.

Students told of hiding between desks and huddling in darkness as the shooter methodically sought out victims. Some students who are military veterans guarded the doors, which did not lock, in case the shooter tried to enter.

“There’s a shooter! Run! Run! Get out of there!” groups of students screamed as they ran out of Snyder Hall, where the rampage started, according to Kenneth Ungerman, 25, a student at the college. Ungerman said he and a National Guard recruiter sought cover underneath his Jeep, then rolled out from under it “and took off,” he said.

Jasmyne Davis, 19, was in class when the gunfire began. She said she heard one gunshot, followed by a 30-second pause, an argument and eight more shots from the classroom next door. “Close the door!” yelled a female classmate who ran out of the classroom, was shot in the arm and fell back into the room.

As authorities frantically tried to secure the campus and sort out what happened, they initially provided conflicting accounts of casualties. Douglas County Sheriff John Hanlin confirmed at an afternoon news conference that 10 people had been killed and seven injured, with the gunman killed in an exchange of fire with police. Hanlin said authorities would not identify the victims for at least a day, possibly two. The FBI later clarified that the 10 fatalities included the gunman.

Hanlin said authorities were not ready to release any information about a possible motive. The News-Review newspaper in Douglas County quoted a student as saying the gunman had asked people their religion before opening fire.

The rampage was the latest in a series of mass shootings that have produced national revulsion, even as they have left Republicans and Democrats divided over whether such violence should lead to stricter gun laws. Thursday’s shootings came three months after nine people were gunned down at a historic African American church in Charleston, S.C.

School shootings have figured prominently in this series of tragedies, including the 1999 massacre at Columbine High School in Colorado, the 2007 Virginia Tech shootings and the deaths of 20 children in 2012 at Sandy Hook Elementary School in Newtown, Conn.

In Washington, a visibly frustrated President Obama offered prayers for the victims and their families and quickly pivoted to repeat his call for stricter gun-safety laws, something he has done throughout his presidency to no avail.

“Each time we see one of these mass shootings, our thoughts and prayers are not enough,” he said. “It’s not enough. It does not capture the heartache and grief and anger that we should feel. It does nothing to prevent this carnage from being inflicted someplace else in America.”

Yet again, the media broadcast images of ambulances ferrying victims to hospitals, and students reported on social media that they had been trapped inside classrooms.

Federal authorities joined officials from Oregon in swarming the rural community college. Agents from the Bureau of Alcohol, Tobacco, Firearms and Explosives arrived in the morning, and additional agents were being dispatched. The FBI field office in Portland also said it was sending agents.

Four guns were recovered from the crime scene, including three pistols and a type of semiautomatic rifle, people familiar with the investigation said. They declined to be more specific.

Officials at Mercy Medical Center in Roseburg said the hospital had received 10 patients from the shooting.

PeaceHealth Sacred Heart Medical Center at RiverBend, a hospital about 70 miles north of the school, said it had three female patients, one in critical condition and the other two in serious condition.

The school will be closed Friday, with its campus remaining an active crime scene, interim president Rita Cavin said at a news conference Thursday. “Today was the saddest day in the history of the college,” she said.

Umpqua, one of 17 community colleges in Oregon, has about 2,000 students and about 200 full- and part-time faculty members. Federal data suggests Umpqua is a quiet campus; the only crimes reported there in recent years have been an occasional burglary and, in 2013, an aggravated assault.

Oregon Gov. Kate Brown (D) ordered flags flown at half-staff through sunset Friday. “Today is heartbreaking for Umpqua Community College, the greater Roseburg community, and all of Ore­gon,” Brown said in a statement

The shooting was first reported before 10:40 a.m. local time (1:40 p.m. Eastern), according to the sheriff’s office, which said students and faculty members were evacuated from campus to the county’s fairgrounds.

Danny Medak, 20, a basketball player at Umpqua, said he heard a loud noise, a pause and then a round of gunshots.

Added Ryan Rundell, 18: “I’ve lived in Douglas County my whole life and I never thought I’d see anything like this.’’

Savannah Nardli was driving to campus to meet her close friends Cheyeanne Fitzgerald and Anastasia Boylan when she got a call from another classmate who told her there had been a shooting on campus. She turned back. “I was like, ‘I’m going home,’ ” she said. “I got the hell out of town.”

Nardli tried Fitzgerald’s cellphone repeatedly but got no answer. So she called Boylan, who picked up. “She said Cheye­anne was shot and that she was bleeding,” said Nardli, 18, who is a distant cousin of Fitzgerald.

McCrae Kittelman, 17, was in the Educational Skills Building, a large open tutoring center, doing homework when his math teacher, Mike Matteo, came running in. It was 10:40 a.m.

“Drop everything you’re doing and get in the back room right now,” Matteo ordered the students.

Everyone — about 20 students and three or four teachers — rushed to a back room where teachers have their offices and got in the one the farthest back. They turned off the lights.

“He told us to crouch down next to anything we could, to lay and sit there quietly,” Kittelman recalled. “Don’t make any movement or sound.”

Hoyt is a freelance writer. Berman and Markon reported from Washington. Susan Svrluga, Abby Phillip, Ellen Nakashima, Darryl Fears and Nick Anderson in Washington contributed to this report.