A Palestinian motorist launched a shooting spree near the Israeli police headquarters in Jerusalem on Sunday, killing two people and wounding five others before being shot dead, officials said.
Police spokeswoman Luba Samri said the attacker sped towards a busy stop of the city's light rail service and opened fire, seriously wounding a 60-year-old woman waiting there.
He then continued driving and shot another woman who was seated in her car, before speeding off towards an Arab neighbourhood in east Jerusalem.
Ms Samri said police officers on motorcycles chased the assailant, who eventually stepped out of his vehicle and opened fire at them. A 30-year-old police officer was critically wounded in the shoot-out.
A separate police force ultimately shot and killed the attacker, Ms Samri said.
She identified him as a 39-year-old man from the east Jerusalem neighbourhood of Silwan.
Israeli media reported the man had previously served multiple sentences for violent acts and was due to report to prison on Sunday for another sentence over assaulting a police officer.
Israel's Magen David Adom emergency medical service said it treated seven people for various gunshot injuries, two of whom later died of their wounds. Police cordoned off the area of the shooting and briefly shut down traffic on the light rail system.
The attack was an unusual one in the year-long spate of Palestinian assaults since most have been stabbings. Sunday’s was the deadliest attack on Israelis since June 8th, when two Palestinians opened fire and killed four people at a popular Tel Aviv food market.
The Palestinian attacks began around last year's Jewish high holidays and have since killed 36 Israelis and two visiting Americans. About 219 Palestinians have been killed during that period, with Israel claiming the vast majority of them were attackers.
Israel has warned that the potential for violence could rise as the Jewish high holidays approach once again and has beefed up its security presence. There has been a recent surge in Palestinian attacks that shattered weeks of relative calm and raised fears of a return to the near-daily attacks seen previously.
Israel has blamed the violence on incitement by Palestinian political and religious leaders, compounded on social media sites. The Palestinians say it is rooted in some 50 years of military occupation and dwindling hopes for independence.
Fawzi Barhoum, a spokesman for Gaza's Islamic Hamas leaders, welcomed the attack in a statement saying it was "a natural response".
Hamas stopped short of taking responsibility for the attack, but identified the assailant as one of its members.
Internal security minister Gilad Erdan said there were no specific warnings of an attack ahead of time and the quick response of security forces on the scene prevented a deadlier result. He repeated his previous criticism of social media sites that allow militants to spread their messages of incitement.
“It has an impact. It pushes people out to the streets to commits acts of murder and terror,” he said.
The United States condemned the latest attacks. “The United States condemns in the strongest possible terms the terrorist attack that took place today in Jerusalem,” US State Department spokesman Mark Toner said in a statement.