At least eight people were killed died and 28 were injured on Monday after a gunman opened fire at the Perm State University in the Russian city of Perm, AP reported.

The 18-year-old gunman is a student of the university and had obtained the weapon – a hunting rifle – in May, Reuters reported, citing the Russia’s law enforcement agency Investigative Committee. The gunman has been taken into custody.

He sustained injuries while resisting the arrest and was taken to a hospital for treatment, the Investigative Committee said.

There were 3,000 students on the campus when the incident took place.

As the gunman opened fire, several students built barricades of chairs to prevent him from entering classrooms, Reuters reported. Videos of the incident showed several students jumping out of windows on the first floor of the university.

Local media reports cited by Reuters said that before the incident, the man had posted a photo of himself on social media posing with a rifle, helmet and ammunition. The news agency could not independently verify the photo.

“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 reportedly said in the post, which was later taken down.

Dmitry Peskov, a spokesperson of the Russian government, said that the country’s President Vladimir Putin has offered condolences to relatives of the deceased, according to news agency TASS. Putin has asked Prime Minister Mikhail Mishustin to send ministers Valery Falkov and Mikhail Murashko to the university to provide assistance to the injured, the spokesperson said.

Meanwhile, the Indian Embassy in Russia confirmed that the Indian students at the university were safe.

“[The] embassy is in touch with local authorities and representatives of Indian students,” it said in a tweet.

This is the second shooting incident at a Russian educational institution in six months.

In May, a teenage gunman had opened fire at a school in Kazan city, killing nine people, according to Reuters. After this incident, Russia had raised the legal age for buying fire arms to 21 from 18.