Four others — among them a man whose condition is described as serious — were injured in the incident, which happened on Sunday morning near the Chain Gate entrance to the al Aqsa mosque compound, also known as the Temple Mount.
The alleged assailant, who used an improvised automatic weapon commonly known as a Carlo, police say, was shot dead by police officers on the scene.
Israel’s public security minister Omar Bar Lev said the gunman was from the neighborhood of Shuafat in east Jerusalem and a member of the political wing of Hamas.
Hamas issued a statement identifying the attacker as Fadi Abu Shkaydam, calling him a heroic martyr and describing him as a local leader of the movement.
It said the attack was “a response to the attempts to desecrate Al Aqsa mosque.”
Israel’s Prime Minister Naftali Bennett told government ministers he was praying for the recovery of the wounded and had instructed security forces to prepare for possible “copycat attacks.”
“We need to be on heightened alert and prevent future attacks,” he said at the start of the weekly Cabinet meeting.
The incident comes four days after a 16-year-old Palestinian was shot dead after carrying out a stabbing attack on two Israeli border police in the Old City, police said.