MOSCOW (AP) - A gunman launched an attack on a school in the Russian city of Kazan that left at least nine people dead Tuesday - including seven youngsters - and sent students hiding under their desks or running out of the building.

At least 21 others were hospitalized, six in extremely grave condition, authorities said.

The attacker, identified only as a 19-year-old, was arrested, officials said. They gave no immediate details on a motive.

But Russian media said the gunman was a former student at the school who called himself “a god” on his account on the messaging app Telegram and promised to “kill a large amount of biomass” on the morning of the shooting.

“I was in the classroom when a man with a firearm broke into our classroom and just started shooting,” said student Akhmat Khairulin. He said students hid under their desks at their teacher's direction, though one jumped out of a window.

Attacks on schools are rare in Russia, and President Vladimir Putin reacted by ordering the head of the country's National Guard to revise regulations on the types of weapons allowed for civilian use.

Four boys and three girls, all eighth-graders, died, as well as a teacher and another school employee, said Rustam Minnikhanov, governor of the Tatarstan republic, where Kazan is the capital.

The teacher who died, Elvira Ignatyeva, had been an English instructor at the school for four years, thye state news agency Tass reported.

Footage released by Russian media showed students dressed in black and white running out of the building. Another video depicted shattered windows, a stream of smoke coming out of one, and the sound of gunfire. Dozens of ambulances lined up at the entrance.

Russian media said while some students were able to escape, others were trapped inside during the ordeal.

“The terrorist has been arrested, 19 years old. A firearm is registered in his name. Other accomplices haven't been established. An investigation is underway,” Minnikhanov said.

Authorities said the 21 hospitalized included 18 children.

Authorities announced a day of mourning on Wednesday and canceled all classes in Kazan schools. Authorities tightened security at all schools in the city of about 1.2 million people, 430 miles (700 kilometers) east of Moscow.

The deadliest school attack in Russia took place in 2004 in the city of Beslan, when Islamic militants took more 1,000 people hostage for several days. The siege ended in gunfire and explosions, leaving 334 dead, more than half of them children.

In 2018, a teenager killed 20 people at his vocational school before killing himself in Kerch, a city in the Russian-annexed peninsula of Crimea. In the wake of that attack, Putin ordered authorities to tighten control over gun ownership. But most of the proposed legislative changes were turned down by the parliament or the government, the Kommersant newspaper reported.

Russian lawmaker Alexander Khinshtein said on Telegram that the suspect in the Kazan attack received a permit for a shotgun less than two weeks ago and that the school had no security aside from a panic button. Authorities did not specify what kind of gun the attacker used.

Authorities in Tatarstan ordered checks on all gun owners in the region.

Putin extended condolences to the families of the victims and ordered the government to give them all necessary assistance. Russian officials promised to pay families 1 million rubles (roughly $13,500) each and give 200,000 to 400,000 rubles ($2,700-$5,400) to the wounded.

The Kremlin sent a plane with doctors and medical equipment to Kazan, and the country's health and education ministers headed to the region.