At least eight people have been killed and six wounded by a Palestinian gunman who infiltrated a Jewish seminary in West Jerusalem, Israeli officials say.
Witnesses said the gunman went into a crowded hall during dinner 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 BBC's Middle East editor Jeremy Bowen says the Israeli government will be under immense pressure to respond - and it will, even though it is not known when and where precisely.
The Palestinian Islamist group, Hamas, praised the attack, calling it "heroic", but did not claim responsibility. There was also celebratory gunfire in Gaza.
Later, the al-Manar satellite television station of the Lebanese Hezbollah movement reported that a previously unknown group called the "Jalil Freedom Battalions - the Martyrs of Imad Mughniyeh and Gaza" was behind the shooting.
Israeli security forces have been on high alert since Mughniyeh, a senior Hezbollah leader and military commander, was killed in a car bomb in Damascus on 12 February.
Hezbollah blamed Israel, which denied any involvement.
Witnesses said the gunman entered the dining hall at the Mercaz Harav seminary, where about 80 people were gathered, and began firing at its students in every direction for several minutes.
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
One man told the BBC that there had been "terrible scenes" inside the seminary in the aftermath of the attack.
"The terrorists were shooting on us. We all hid under the cars," he said.
"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 because the terrorist guys went inside and killed those guys who were only here studying in Jerusalem."
Yaron Tzuker, a medic, said he arrived as the gunfire was still going on.
"We took cover and the ambulance was hit. It's horrible inside - dead bodies and wounded - it's horrific," he told Channel 10 television.
Israeli police and military personnel later searched the building and the surrounding area in order to determine whether there had been a second assailant, but Jerusalem's police commander said there had been only one man.
"He hid the weapon in a cardboard box," Aharon Franco told reporters.
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 Franco said an Israeli army officer who lived nearby had run to the school after hearing gunfire and shot the gunman dead.
Jerusalem Mayor Uri Lupolianski told Israeli Channel 2 television: "It's very sad tonight in Jerusalem - many people were killed in the heart of Jerusalem."
An Israeli foreign ministry spokesman said "terrorists are trying to destroy the chances of peace, but we will certainly continue peace talks" with Palestinian Authority President Mahmoud Abbas, who also condemned the attack.
"The president condemns all attacks that target civilians, whether they are Palestinian or Israeli," said a statement released by Mr Abbas' office.
The US Secretary of State, Condoleezza Rice, who held talks with Israeli and Palestinian leaders earlier this week in an attempt to revive the stalled peace negotiations, condemned the shooting as an "act of terror and depravity".
The Mercaz Harav seminary is a well-known centre for Jewish studies and most students are aged between 18 and 30. It is said to be associated with the leadership of the Jewish settler movement in the West Bank.
In the Hamas-controlled Gaza Strip, gunmen fired into the air after news broke about the attack. A loudspeaker in Gaza City reportedly broadcast the message: "This is God's vengeance".
Celebrations in the Gaza Strip (6 March 2008)
This heroic attack in Jerusalem is a normal response to the crimes of the occupier and its murder of civilians
Sami Abu Zuhri
A spokesman for Hamas, Sami Abu Zuhri, said the group "blesses the heroic operation in Jerusalem, which was a natural reaction to the Zionist massacre".
The BBC's Crispin Thorold says this will be a particularly shocking incident for the Israeli public and Jewish people around the world - which comes at an extremely tense time. Israel, he says, is likely to take retaliatory action.
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, 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 measures are designed to stamp out frequent rocket fire by Palestinian militants.
Recent rocket attacks have hit deeper into southern Israel, reaching Ashkelon, the closest large city to the Gaza Strip.