The gunman entered the school's dining room and opened fire

Attack scene

Witnesses said the gunman went into the library at the Mercaz Harav seminary in the city's Kiryat Moshe quarter and opened fire.

The assailant, who Israeli police said was a resident of East Jerusalem, was shot dead by an Israeli army officer.

The attack is the worst of its kind in Israel for a number of years.

The White House has led international condemnation but the Palestinian Islamist group Hamas called the attack "heroic" while not claiming responsibility.

When we got in... we saw young, 15-, 16-year-old guys lying on the floor with their Bibles in their hands - all dead on the floor

Witness

In pictures: Seminary attack Witnesses describe carnage World reaction in quotes

However, the 15-strong UN Security Council failed to agree on a resolution condemning the attack because of reservations from temporary member Libya, which sought to link it to Israeli actions in the Gaza Strip.

A previously unknown group called the "Jalil Freedom Battalions - the Martyrs of Imad Mughniyeh and Gaza" claims to have carried it out, according to Lebanese Hezbollah media.

The fact that the school is at the heart of the settler movement in the occupied West Bank may have been the reason why it was targeted, BBC Middle East editor Jeremy Bowen reports.

Many of its students are on special courses that combine religious study with service in combat units in the Israeli army, he notes.

There will be an Israeli response to this attack, our Middle East editor adds - the question is how severe it will be.

'Horrific'

The gunman entered the library at the Mercaz Harav seminary on Thursday evening, where about 80 students were gathered, and fired an AK-47 rifle for several minutes, witnesses say.

MERCAZ HARAV SEMINARY Founded in 1924 by influential Rabbi Avraham Hacohen Kook Some 500 students enrolled in Talmudic study Students mainly high-school age and young adults Graduates serve as rabbis and rabbinical judges in Israel and Jewish settlements School has played a major role in ideology and theology of Israeli religious settlement movement Key figures linked to the school were strongly opposed to Israeli pull-out from Gaza

One of the students, Yitzhak Dadon, reportedly shot the gunman twice before he was finally killed by an off-duty Israeli army officer, who had gone to the school after hearing gunfire.

"I shot him twice in the head," he told the Reuters news agency.

"He started to sway and then someone else with a rifle fired at him, and he died."

Another man told the BBC that there had been "terrible scenes" inside the building afterwards.

"When we got in... we saw young, 15-, 16-year-old guys lying on the floor with their Bibles in their hands - all dead..." he said.

Jerusalem police commander Aharon Franco confirmed there had been only one gunman and said he had hidden his weapon in a cardboard box.

Imad Mughniyeh, a senior Hezbollah leader and military commander, was killed in a car bomb in Damascus on 12 February.

'Aimed at the heart'

An Israeli foreign ministry spokesman said that "terrorists [were] trying to destroy the chances of peace" but peace talks with Palestinian Authority President Mahmoud Abbas would continue.

DEADLY ATTACKS IN ISRAEL 4 Feb 2008: One dies, Dimona suicide bombing 29 Apr 2007: Three die, Eilat suicide bombing 17 Apr 2006: Nine die, 40 wounded, suicide bombing near old bus station in Tel Aviv 30 Mar 2006: Four die, Kedumim suicide bombing 29 Dec 2005: Thee die, suicide bombing near Tulkarm 5 Dec 2005: Five die, Netanya suicide bombing 26 Oct 2005: Six die, Hadera market suicide bombing 12 July 2005: Two die, Netanya suicide bombing 25 Feb 2005: Five die, 50 hurt, suicide bombing outside Tel Aviv nightclub 13 Jan 2005: Six die, suicide bombing at Karni crossing

Mr Abbas condemned the attack in a statement saying he "condemns all attacks that target civilians, whether they are Palestinian or Israeli".

US President George W Bush condemned the attack "in the strongest possible terms" and UK Foreign Secretary David Miliband said news of the killings was "shocking".

"They are an arrow aimed at the heart of the peace process so recently revived," Mr Miliband added.

UN Secretary General Ban Ki-moon also criticised the "deliberate killing and injuring of civilians" in what he called a "savage attack".

Hamas praise

In the Hamas-controlled Gaza Strip, gunmen fired into the air after news broke about the attack.

This heroic attack in Jerusalem is a normal response to the crimes of the occupier and its murder of civilians

Sami Abu Zuhri

Hamas spokesman

A loudspeaker in Gaza City reportedly broadcast the message: "This is God's vengeance"

Hamas spokesman Sami Abu Zuhri said the group "blesses the heroic operation in Jerusalem" calling it as a "natural reaction" to Israeli attacks.

Last week, Israeli forces launched a raid into northern Gaza in which more than 120 Palestinians - including many civilians - were killed.

Shortly after the Jerusalem shooting, the Palestinian militant group Islamic Jihad said four of its fighters had been killed in an Israeli air strike in the southern Gaza town of Khan Younis.

Israel says the recent military offensive has been designed to stamp out frequent rocket fire by Palestinian militants.

Rocket attacks have hit deeper into southern Israel, reaching Ashkelon, the closest large city to the Gaza Strip.