The attack shattered the first week of classes at Umpqua Community College in the small timber town of Roseburg, about 180 miles south of Portland.
The killer was identified as 26-year-old Chris Harper Mercer, according to a government official who was not authorized to speak publicly and provided the name on condition of anonymity. Authorities shed no light on his motive and said they were investigating.
PHOTOS: Deadly campus shooting at Umpqua Community College in Oregon
Hannah Miles, a 19-year-old freshman, was in her writing class when her teacher got a call from security saying the school was in lockdown. She heard gunshots from a neighboring classroom.
Huddled together in the locked classroom, the students and teacher heard a footsteps outside and a man's voice call out to them, "Come on out, come on out," Miles said. They remained quiet and didn't open the door.
Police soon arrived, Miles said, and after students were convinced that it was indeed officers, they opened the door.
"It was like a huge burden had been lifted," she said. "A huge sigh of relief that we were going to be OK."
Douglas County Sheriff John Hanlin said at least two officers acted heroically in the shootout, but it was not clear if the gunman was killed by authorities or whether he took his own life.
At a news conference, a visibly angry Hanlin said he would not name the shooter.
"I will not name the shooter. I will not give him the credit he probably sought prior to this horrific and cowardly act," he said.
Mercer had been living at an apartment complex in nearby Winchester. Yellow police tape surrounded the building Thursday night.
A neighbor, Bronte Hart, said Mercer would "sit by himself in the dark in the balcony with this little light."
Hart said a woman she believed to be Mercer's mother also lived upstairs and was "crying her eyes out" Thursday.
MORE: Hurricane Joaquin strengthens to "extremely dangerous" Category 4 hurricane
Sarah Cobb, 17, was in a writing class when gunfire erupted in the next room. She heard a shot, but thought a book had fallen. Then a teacher said they needed to get out, and the class ran out the door as she heard two more shots.
"I was freaking out. I didn't know what to think, what to do," she said.
Distressed parents rushed to the county fairgrounds, where students were being taken by bus to reunite with families.
Jessica Chandler was at the fairgrounds desperately seeking information about her 18-year-old daughter, Rebecka Carnes.
"I don't know where she is. I don't know if she's wounded. I have no idea where she's at," Chandler said.
Carnes' best friend told Chandler that her daughter had been flown by helicopter to a hospital, but she had not been able to find her at area medical centers.
The sheriff said 10 people were dead and seven wounded. An FBI spokeswoman said the gunman was included in that number. Earlier, Oregon Attorney General Ellen Rosenblum said 13 people had been killed. It was unclear what led to the discrepancy.
"It's been a terrible day," a grim-faced Hanlin said. "Certainly this is a huge shock to our community."
Hours after the attack, a frustrated President Barack Obama spoke to reporters at the White House, saying the U.S. is becoming numb to mass shootings and that the shooters have "sickness" in their minds.
Repeating his support for tighter gun-control measures, the president said thoughts and prayers are no longer enough in such situations because they do nothing to stop similar attacks from happening a few weeks or months later. He challenged voters wanting to confront the problem to vote for elected officials who will act.
Police began receiving calls about a campus shooting at 10:38 a.m. The school has a single unarmed security guard.
Kortney Moore, 18, said she was in a writing class when a shot came through the window and hit the teacher in the head.
The gunman then entered the Snyder Hall classroom and told people to get on the floor, she told the Roseburg News-Review newspaper. He told people to stand up and state their religion before opening fire.
Next door, students heard a loud thud and then a volley of gunfire, Brady Winder, 23, told the newspaper.
Students scrambled "like ants, people screaming, 'Get out!'" Winder said. He said one woman swam across a creek to get away.
The gunfire sparked panic as students ran for safety and police and ambulances rushed to the scene.
Lorie Andrews, who lives across the street from the campus, heard what sounded like fireworks and then saw police cruisers streaming in. She spoke with students as they left.
"One girl came out wrapped in a blanket with blood on her," she said.
Some students were in tears. Police lined them up in a parking lot with their hands over their heads and searched them.
Roseburg is no stranger to school gun violence. A freshman at the local high school shot and wounded a fellow student in 2006.
The sheriff has been vocal in opposing state and federal gun-control legislation. In 2013, Hanlin sent a letter to Vice President Joe Biden after the shooting at a Newtown, Connecticut, elementary school, declaring that he and his deputies would refuse to enforce new gun-control restrictions "offending the constitutional rights of my citizens."
Before the Roseburg shooting, a posting on the message-board site 4chan included a photo of a crudely drawn frog used regularly in Internet memes with a gun and warned other users not to go to school Thursday in the Northwest. The messages that followed spoke of mass shootings, with some egging on and even offering tips to the original poster. It was unclear if the messages were tied to the shooting because of the largely anonymous nature of the site.
Roseburg is in Douglas County, a politically conservative region west of the Cascade Range where people like to hunt and fish and pursue other outdoor activities. Many of the students in local schools go on to attend the college of 3,000 students.
Former UCC President Joe Olson, who retired in June after four years, said the school had no formal security staff, just one officer on a shift.
One of the biggest debates on campus last year was whether to post armed security officers on campus to respond to a shooting.
"I suspect this is going to start a discussion across the country about how community colleges prepare themselves for events like this," he said.
There were no immediate plans to upgrade security on the campus in light of the shooting, Cavin said.