Great Mills High, like so many other schools across the country, was already reckoning with school violence in the aftermath of the Florida shooting. There had been new discussions about school safety. There was an ominous Snapchat posting about a possible threat, which stirred worry but was found to be a hoax. Last week, there was a walkout by students calling for stronger gun control measures.

And then, shortly before 8 a.m. on Tuesday, the authorities said, Mr. Rollins pulled out his weapon and opened fire.

“It sounded like a shelf, like something fell,” said Shawnye Willis, 17, who was standing in the hallway, near an art class.

But then he saw a girl fall forward, and collapse on the ground. When she dropped, he said, he knew it was serious. Teachers yelled for students to get into classrooms, and people began to cry.

The principal, Jake Heibel, announced on the loudspeaker that the school was going into lockdown.

Saar Shah, 15, was working on a robotics assignment when he saw the flashing lights of police cars pull up to the school.

“I was thinking about this project,” Mr. Shah said. “I didn’t think my school was going to get shot up.”

Even students who had been deeply involved in gun control activism after the Parkland shooting, like Mollie Davis, who handed out stickers to fellow students during last week’s walkout, were stunned to find themselves at the center of an issue that had seemed urgent but far away.