Updated

Militants holding hundreds of hostages at a school in southern Russia freed at least 31 women and children, some of them babies, according to Russia's ITAR-Tass news agency.

Soldiers in fatigues could be seen carrying out infants and escorting women and small children out of the school Thursday afternoon, where militants held more than 300 people hostage for a second day. The freed hostages were put into cars and taken away — including one woman with a naked child and a baby — but the standoff continued.

The release was the result of negotiations with the terrorists Thursday, officials told FOX. Authorities were exercising caution as the extremists were said to be heavily armed — some with bombs strapped to their bodies.

Officials expressed hope that negotiations would bring more progress in the standoff in southern Russia.

The school in Beslan, a town of about 30,000, is in North Ossetia (search), near the war-torn republic of Chechnya (search) where separatist rebels have been fighting Russian forces since 1999. Suspicion in the raid fell on Chechen militants although no claim of responsibility has been made.

A crowd of waiting relatives and friends immediately swarmed around Lev Dzugayev, an aide to the North Ossetian president, in an attempt to find out information about who was freed after Dzugayev first announced the release.

The hostages were set free shortly after two large blasts went off near the school. Terrorists stormed the school early Wednesday, making a number of demands involving Chechnya.

The terrorists had fired on two cars that got too close to the school and were also sporadically firing rocket-propelled grenades and assault rifles, officials said, but neither car was hit.

Parents of the schoolchildren had begged police not to storm the building out of fear that a forced entry would enrage the terrorists into killing the hostages, FOX News has learned.

The militants who stormed the school Wednesday had threatened to blow it up if Russian forces launched an assault to free the hostages — but there was no sign that any operation or battle was underway.

Russian authorities and the militants spent Wednesday night negotiating on the telephone.

Valery Andreyev, the Federal Security Service's chief in North Ossetia, said authorities have ruled out the use of force in dealing with the crisis for now, Reuters news service reported, quoting ITAR-Tass.

"There is no alternative to dialogue," Andreyev told ITAR-Tass news agency. "One should expect long and tense negotiations."

In his first public comment on the raid, President Vladimir Putin (search) Thursday pledged to do everything possible to save the lives of the hundreds of hostages.

"We understand these acts are not only against private citizens of Russia but against Russia as a whole," Putin said in comments broadcast on Russian television during a Kremlin meeting with Jordan's King Abdullah II. "What is happening in North Ossetia is horrible.

"It's horrible not only because some of the hostages are children but because this action can explode even a fragile balance of interconfessional and international relations in the region," Putin said.

Russian officials had negotiated fruitlessly through the night to end the standoff. Crowds of distraught relatives and townspeople waited helplessly for news of their loved ones.

Dzugayev said brief contact with the captors indicated they were treating the children "more or less acceptably" and were holding them separately from the adults.

Dzugayev said the attackers might be from Chechnya or another neighboring region, Ingushetia; relations between Ingush and Ossetians have been tense since an armed conflict in 1992. But in Washington, a U.S. official speaking on condition of anonymity said the hostage-takers were believed to be Chechen rebels.

The hostage-taking came less than 24 hours after a bombing outside a Moscow subway station that killed at least nine people, and just over a week after near-simultaneous explosions blamed on terrorism caused two Russian planes to crash, killing all 90 people on board.

With violence spreading across the country, many Russians worry about their safety. Official talk of increasing security after terrorist attacks is dismissed by many, and while tight measures were put in place in North Ossetia after the hostage crisis, few signs of major changes have been visible elsewhere.

The recent bloodshed is a blow to Putin, who pledged five years ago to crush Chechnya's rebels but instead has seen the insurgents increasingly strike civilian targets beyond the republic's borders.

FOX News' Dana Lewis, Catherine Donaldson-Evans and The Associated Press contributed to this report.