A friend of the injured woman dragged her into the room and began delivering CPR, Ms. Welding said. Someone clicked the door shut and the students huddled in the corner, blocking themselves with desks and backpacks. “I heard more shooting,” Ms. Welding said. “It was horrific. My whole body was shaking. A chill was going down my spine. We called 911.”

She added, “I was on the phone with my mom pretty much the entire time. I knew this could have been the last time I talked to her.”

Brady Winder, 23, who moved to Roseburg only three weeks ago, was in a writing class.

“We heard one shot,” Mr. Winder said. “It sounded like someone dropped something heavy on the floor, and everybody kind of startled. There’s a door connecting our classroom to that classroom, and my teacher was going to knock on the door, but she called out, ‘Is everybody O.K.?’ And then we heard a bunch more shots. We all froze for about half a second. Everybody’s head turned and looked at each other, trying to just grasp what was happening, and someone said, ‘Those are gunshots.’ We heard people screaming next door. And then everybody took off. People were hopping over desks, knocking things over.”

Kortney Moore, 18, from Rogue River, told the Roseburg newspaper, The News-Review, that the gunman had asked people to stand up and state their religion and then started firing. She said she saw her teacher shot in the head, adding that she herself was on the floor with people who had been shot.

Federal law enforcement officials said they were examining an online conversation on 4chan, an anonymous message board, as well as other social media, trying to determine whether any of it was linked to the gunman. In that conversation, one writer said, “Don’t go to school tomorrow if you are in the Northwest.”