A gunman killed six people and injured 28 others at a university in the Russian city of Perm, officials have said.
The assailant walked on to the campus on Monday morning and started shooting.
Students and teachers barricaded themselves inside the university building, while others were seen screaming and jumping from windows.
Authorities said the attacker, a student at the university, was injured and detained by police.
Russia’s interior ministry said the attacker was shot during an exchange of gunfire with a police officer Konstanin Kalinin, who was one of the first to arrive at the scene.
Mr Kalinin then disarmed the assailant, who had a gun and a knife, before administering first aid.
In a statement, President Vladimir Putin called the shooting “a great loss not only for the families who lost their children but for the whole country.”
The incident occurred at 11:00 (06:00 GMT) at Perm State University, located around 1,300 kilometres (800 miles) east of the capital, Moscow, in the Urals. Officials initially reported eight had died, but subsequently revised the death toll down.
One professor at the university described students leaping out of buildings: “They jumped out in some horror, screaming,” he told the BBC.
“One of the students told me that it was a shooting. I heard pops, everyone began to scatter in different directions. I went to my students in the second building and continued to hear the pops.”
Other students locked themselves into classrooms in a bid to escape the gunman.
“There were about 60 people in the classroom. We closed the door and barricaded it with chairs,” one student, Semyon Karyakin, told Reuters news agency.
This piece of footage of students jumping to safety was broadcast on Russian TV:
The gunman reportedly acted alone and said he had no political or religious motives.
In a social media post he also said he was consumed by hatred and intended to do harm to others.
“I’ve thought about this for a long time, it’s been years and I realised the time had come to do what I dreamt of,” he said on a social media account attributed to him that was later taken down, Reuters news agency reports.
Earlier this year, a 19-year-old gunman opened fire in his old school in the central Russian city of Kazan, killing nine people.