Updated

More than 340 people, including 155 children, were killed in the violence that ended a hostage standoff with militants at a southern Russian school, a prosecutor said Saturday. President Vladimir Putin (search) accused the attackers of trying to spark an ethnic conflict that would engulf Russia's troubled Caucasus Mountains region.

Russian Deputy Prosecutor Sergei Fridinsky told reporters that 322 victims were killed, as well as all 26 militants involved in the seizure of the school. That raised the death toll well beyond the 250 officials had previously cited.

Medical officials said more than 542 people including 336 children were hospitalized after the eruption of violence that ended the 62-hour hostage drama on Friday. The hostage-takers — who had been demanding independence for nearby Chechnya (search) — held the more than 1,000 hostages in the school's sweltering gymnasium, refusing to let in food or water.

Commandos stormed the school after the militants set off explosions and began shooting at hostages who fled. The result was 10 hours of chaos. Crying children, some naked and covered with blood, fled the scene or were carried out amid explosions and gunfire. Security forces chased militants who split into groups and took refuge in a home and a basement. During the initial explosions, part of the school roof collapsed, causing many deaths.

Putin flew to Beslan, in the southern republic of North Ossetia (search), before dawn Saturday, as smoke was still rising from the shattered school.

"Even alongside the most cruel attacks of the past, this terrorist act occupies a special place because it was aimed at children," he said during a meeting with regional officials, which was broadcast on Russian television.

He stressed that security officials had not planned to storm the school — trying to fend off any potential criticism that the government side had provoked the bloodshed. Some North Ossetians complained, however, that his visit was too little, too late.

"Why didn't he come earlier? .... Why did he come in the middle of the night?" said Irina Volgokova, 33, whose close friend and the friend's daughter were missing.

"He is the head of our country. He should answer for this before the people."

Dozens of people crowded around lists of survivors posted at the Beslan hospital, searching desperately for news of loved ones who were not yet accounted for. A man showed hospital nurses a photograph — a young boy dressed in a suit, like he was going to a birthday party or holiday celebration.

"We run here, we run there, like we're out of our minds, trying to find out anything we can about them," said Tsiada Biazrova, 47, whose neighbors' children had yet to be found.

For some, grief had turned to anger.

"Fathers will bury their children, and after 40 days (the Orthodox Christian mourning period) ... they will take up weapons and seek revenge," said Alan Kargiyev, a 20-year-old university student in the regional capital Vladikavkaz.

The school attack followed a homicide bomb attack outside a Moscow subway station Tuesday that killed eight people, and last week's near-simultaneous crash of two Russian jetliners last week after what officials believe were explosions on board.

Putin warned against letting the latest attack stir up tensions in the multiethnic North Caucasus region. "One of the goals of the terrorists was to sow ethnic enmity and blow up the North Caucasus," Putin said.

"Anyone who gives in to such a provocation will be viewed by us as abetting terrorism," he said.

Putin ordered the region's borders closed while officials searched for everyone connected with the attack.

Putin visited several of the hospitalized victims, stopping to stroke the head of one injured child and the arm of the school principal. Six badly wounded children including a two-year-old were flown to Moscow for treatment, the Emergency Situations Ministry said.

Russian authorities said the bloody end to the standoff came after explosions apparently set off by the militants — possibly by accident — as emergency workers were entering the school to collect the bodies of slain hostages.

As hostages took their chance to flee, the militants opened fire on them, and security forces — along with town residents who had brought their own weapons — opened covering fire to help the hostages escape. Commandos stormed into the building and secured it, then chased fleeing militants in the town, with shooting lasting for 10 hours.

The Federal Security Service chief in North Ossetia, Valery Andreyev, said more than 30 militants had seized the school, and Channel One and NTV television reported that three of them had been captured. However, Fridinsky, the prosecutor, later said the final number of attackers was 26 and all had been killed.

The bodies of at least six militants lay outside the school on Saturday, surrounded by black metal and plastic weapons parts and bullets. A forensic investigator studied the bodies.

An explosives expert told NTV television that the hostage-takers, themselves strapped with explosives, hung bombs from basketball hoops in the gym and set other explosive devices in the building.

Ten militants killed in gunfights with security forces were from Arab countries, Andreyev said, and Putin's adviser on Chechnya, Aslanbek Aslakhanov, said nine were "Arab mercenaries."

An Arab presence among the attackers would boost Putin's argument that the Russian campaign in neighboring Chechnya, where mostly Muslim separatists have been fighting Russian forces in a brutal war for most of the past decade, is part of the war on international terrorism — seen by Putin's critics as an attempt to deflect human rights criticism.

The region's governor, Alexander Dzasokhov, said Friday that the militants had demanded that Russian troops leave Chechnya — the first solid indication that the attack was connected to the rebellion. Andreyev said Saturday that investigators were looking into whether militants had smuggled the explosives and weapons into the school and hidden them during a renovation this summer.

Alla Gadieyeva, a 24-year-old hostage who was seized with her son and mother — all three were among the survivors — said the captors laughed when she asked them for water for her mother.

"When children began to faint, they laughed," Gadieyeva said. "They were totally indifferent."

Two emergency services workers were killed and three wounded during the chaos, Interfax reported. More than 10 special services officers were killed, the news agency reported.

Two major hostage-taking raids by Chechen rebels outside the war-torn region in the past decade provoked Russian rescue operations that led to many deaths. The seizure of a Moscow theater in 2002 ended after a knockout gas was pumped into the building, debilitating the captors but causing almost all of the 129 hostage deaths.

In 1995 — during the first of two wars in Chechnya in the past decade — rebels led by guerrilla commander Shamil Basayev seized a hospital in the southern Russian city of Budyonnovsk, taking some 2,000 people hostage. The six-day standoff ended with a fierce Russian assault, and some 100 people died.