A gunman opened fire at a rabbinical seminary in west Jerusalem late Thursday, killing eight people before he was shot to death, police said.
Nine others were wounded in the Jerusalem attack, the city's first in more than four years, police and rescue workers said. Officials originally said two gunmen were involved in the attack, but said later there was only one.
The United States immediately condemned the "barbarous" attack. Israeli government spokesman Mark Regev and moderate Palestinian President Mahmoud Abbas also condemned the shooting. But in Gaza City thousands celebrated in the streets, firing rifles after hearing of the seminary attack. The militant group Hamas praised the attack but stopped short of claiming responsibility.
"We bless the [Jerusalem] operation. It will not be the last," Hamas said in a text message sent to reporters.
Police commander Aharon Franco told reporters at the scene that "an Israeli army officer nearby" then shot and killed the gunman, a Palestinian from east Jerusalem with an Israeli ID card that allowed him to move freely within the city unlike other Palestinians in the West Bank and Gaza.
Sirens blared through the area where the Mercaz Harav yeshiva is located as hundreds of police and emergency personnel rushed to the scene.
One witness told CBC's Peter Armstrong that he heard five minutes of heavy automatic gunfire and screaming from the school.
Police said the gunman opened fire after entering the yeshiva's dining hall where about 80 people were gathered. Bodies were found by the entrance and in the library, they said.
"He opened fire at anyone he saw in the academy," said Micky Rosenfeld, an Israeli National Police spokesperson.
'It's very sad tonight in Jerusalem'
The seminary is in the Kiryat Moshe quarter of the city, a well-known centre of Jewish studies identified with the leadership of the Jewish settlement movement in the West Bank.
"It's very sad tonight in Jerusalem. Many people were killed in the heart of Jerusalem," Jerusalem Mayor Uri Lupolianski.
Earlier Thursday, an Israeli soldier was killed and three others wounded when Palestinian militants ambushed an army patrol on the Gaza border, the Israeli army said.
The seminary attack came a day after Palestinian President Mahmoud Abbas agreed to resume peace negotiations with Israel.
U.S. Secretary of State Condoleezza Rice condemned the attack, calling it an "act of terror and depravity."
"This barbarous act has no place among civilized peoples and shocks the conscience of all peace-loving nations," she said. "There is no cause that could ever justify this action."
Alan Baker, Israeli ambassador to Canada, told CBC News he expects the peace talks will continue.
On Tuesday, Israeli ground troops withdrew from the Gaza Strip following an offensive to stop Hamas from firing rockets into the southern part of the country.
There were no attacks by Palestinian militants in Jerusalem during 2007, though police and the military say they've foiled numerous attempts.
Between 2001 and 2004, at the height of Palestinian-Israeli fighting, Jerusalem was frequently the target of Palestinian attacks.