In the confusion that followed, numerous law enforcement officers rushed to the scene and a US marshal accidentally shot a Homeland Security agent, Brewster County Sheriff Ronny Dodson said.
Dodson said the agent was in stable condition; he didn't release the condition of the wounded student. Her injuries didn't appear to be life-threatening.
Dodson said the student who died moved about six months ago to Alpine, a community of about 6,500 people roughly 200 miles southeast of El Paso. Dodson didn't identify her or provide a motive but said her family is cooperating.
"I understand she was a very good student," the sheriff said. "That's part of the investigation, what triggered this."
Alpine police Chief Russell Scown said his department heard about 9 a.m. local time (10 a.m. ET) that students were running out of the school.
A deputy happened to be driving by and entered the band hall, Dodson said. He found the shooter dead in a bathroom with a gun nearby, Dodson said.
Video showed students evacuated from the building huddled together and hugging each other. Police officers patrolled the streets outside the school. Officers from other jurisdictions descended on Alpine in force.
The Brewster County Sheriff's Office initially said two shooters were believed to be on the loose, but Dodson said later that with the initial shooter dead, no others were being sought.
Authorities also were trying to find a person who telephoned bomb threats to an Alpine hospital and nearby Sul Ross State University, Dodson said. A note making a bomb threat was found on a motel door, he said.
"We had four active crime scenes," the sheriff said.
"None of the prank calls are coordinated or have anything to do with the shooting at the school," Scown said.
Officers with bomb-sniffing dogs searched each university building for explosives, Dodson said. None were found
'There was blood on the floor'
A junior at the school told CNN that students had just started the day's second period when a teacher outside her class began yelling, "Get in the classroom!"
"My teacher ... yelled to everyone to get into the closet," said the junior, whom CNN is not naming because she is a minor.
"We heard someone yelling and running down the hall. We all started crying."
After a time, a law enforcement officer banged on the classroom door and ushered the students out, she said.
"There was blood on the floor in the cafeteria that I saw when we went past it on our way out of the school," the student said. "One of the officers told us to keep our hands up and run out of the building, so I only saw the blood quickly."
"It was so scary and very intense. I've never been so scared in my life."
The school, which has about 280 students, initially was placed on lockdown, the school district said. But students were being evacuated by 9:40 a.m., the Alpine Avalanche newspaper said on its Facebook page.
In a post reporting the evacuation, the Avalanche included an image of people gathering outside along a street.
Thursday's shooting came just over two weeks after the new school year began.
Residents of Alpine thought they were immune to seemingly random gun violence, the sheriff said at a news conference. The school does not have metal detectors or school resource officers, he noted.
"You can believe we are upset," he said. "We are still in shock for the most part."