JERUSALEM — A Hamas militant on Sunday opened fire in Jerusalem’s Old City, killing one Israeli and wounding four others before he was fatally shot by Israeli police.

It was not immediately clear whether Hamas, an Islamic militant group sworn to Israel’s destruction, had ordered the attack or whether one of its members had acted alone. Hamas, which controls the Gaza Strip, has largely adhered to a cease-fire with Israel since an 11-day war last May and shootings attacks inside the Old City are rare.

Police said the attack took place near an entrance to a contested flashpoint shrine known to Jews as the Temple Mount and to Muslims as the Noble Sanctuary. Violence surrounding the site, which is considered holy by both faiths, has triggered previous rounds of fighting.

Israeli officials said Eliyahu Kay, a 26-year-old immigrant from South Africa, was killed in the shooting. One of the four people wounded was in serious condition.

Police identified the attacker as a 42-year-old Palestinian from east Jerusalem. Palestinian media identified him as Fadi Abu Shkhaidem, a high school teacher.

In Gaza, Hamas praised the attack as a “heroic operation” and said Abu Shkhaidem was one of its members. However, the group stopped short of claiming responsibility for the attack.

Hamas has fought four wars against Israel since it took control of Gaza from the rival Fatah group in 2007.

Sunday’s incident was the second of its kind in Jerusalem’s historic Old City in recent days. On Wednesday, a Palestinian teen was fatally shot after stabbing two Israeli border police.