Updated

The deadly attack that rocked a Crimea vocational college Wednesday morning was carried out by a fourth-year student, who killed at least 19 of his schoolmates and wounded more than 50 others before killing himself, a top Russian official said.

The prime minister of Russia-annexed Crime, Sergei Aksyonov, said on state television the gunman acted alone during the assault on Kerch Polytechnic College in the Black Sea city of Kerch. The shooter was later identified as Vladislav Roslyakov, 18, who officials said had lived in the area. A motive in the attack wasn't immediately clear.

Though initial reports of the attack cited a detonation of some sort of improvised explosive device, it was unclear whether a bomb was used during the attack. But surveillance video soon circulated on social media purporting to show Roslyakov with a gun slung over his shoulder walking through the school, and several students described the horrifying sounds of gunfire echoing through the halls.

Russia's Investigative Committee, the nation's top investigative agency, said all the victims died of gunshot wounds, contrasting with the previous statements by other officials saying some were injured in an explosion.

The Komsomolskaya Pravda newspaper quoted student Semyon Gavrilov, who said he fell asleep during a lecture and woke up to the sound of shooting. Gavrilov said he looked out and saw a young man with a rifle firing at people.

"I locked the door, hoping he wouldn't hear me," said Gavrilov, who recalled seeing dead bodies lining the floor and charred walls as he evacuated the school with the help of police. Gavrilov said about 10 minutes had passed between him waking up and when police arrived to evacuate the school.

Russian President Vladimir Putin said the attack was a tragedy and offered condolences to the victims' families. He said investigators were looking into the circumstances of the attack and the motive of the attacker.

The Tass news agency reported most of the victims were students.

At least 17 people were killed and 40 others were injured on Wednesday at a vocational college in Crimea. (AP)

“There are already lots of people in the emergency room, and in the operating theater," a school employee told Tass.

Initially, emergency officials said an explosive device went off at the college's canteen and was rigged with shrapnel. Sergei Melikov, a deputy chief of the Russian National Guard, said the device was homemade. Explosives experts inspected the college building for other possible bombs, according to Anti-Terrorism Committee spokesman Andrei Przhezdomsky.

Witnesses did not speak of an explosion but said one or more armed men attacked the school.

Photos from the scene posted by Kerch.FM showed debris on the ground and windows of the building blown out.

Reuters reported that officials told local residents to pick up their children from schools in the city due to safety concerns.

Russia annexed Crimea from Ukraine in 2014, a move that triggered Western sanctions and worldwide condemnation. Kerch is located on the peninsula where a bridge links Russia and Crimea, Reuters reported.

The Associated Press contributed to this report.