JERUSALEM - Three Palestinians armed with automatic weapons, explosive devices and knives killed an Israeli security officer and seriously wounded another in Jerusalem on Wednesday before police shot and killed the attackers, police said.

It was one the most brazen attacks in nearly five months of near-daily Palestinian assaults, mostly stabbings, on Israeli police, soldiers and civilians. Israel has struggled to contain the violence, despite sending troops to secure cities, expanding police powers and toughening punishments for attackers.

Wednesday's attack took place after Israeli paramilitary border police officers on a security patrol noticed three people who aroused their suspicion near the Old City's Damascus Gate, a central shopping area for Palestinians as well as a main tourist draw, police spokeswoman Luba Samri said.

Get Breaking News Delivered to Your Inbox

The officers stopped them, and as they began checking one of their ID cards, the other two drew guns and knives and attacked two female officers. One of the officers, identified as 19-year-old Hadar Cohen, later died, police said.

Police officers opened fire and killed the three Palestinians. They then defused the explosive devices they were carrying.

"The weapons indicate that a combined attack was prevented by officers who protected city residents with their own bodies," Samri said in a statement.

Police identified the Palestinians as two 20-year-olds and one 21-year-old from the area of Jenin, in the northern West Bank. The Jenin Palestinian liaison office, which deals with Israel on security issues, gave their names as Ahmad Zakarneh, Ahmad Abu Alrub and Mohammed Kmail.

Associated Press video from the scene showed throngs of police officers weaving through a crowd of Palestinians and a row of police cars with sirens blaring. A police spokesman sent reporters a photo of a group of officers standing around a pool of blood near the gate.

Since mid-September, 27 Israelis have been killed in Palestinian attacks. At least 154 Palestinians have died from Israeli fire, including 109 Israel said were attackers. The rest have been killed in clashes with Israeli troops.

Israel says the violence has been fueled by a Palestinian campaign of lies and incitement. The Palestinians say it is rooted in frustrations stemming from nearly 50 years of Israeli occupation.

It was not immediately clear if Wednesday's attack was carried out by a militant group.

Hamas, the Islamic militant group that rules the Gaza Strip, praised the attack as "heroic," lauding the assailants' ability to reach Jerusalem despite a maze of Israeli checkpoints in the West Bank. The group stopped short of claiming responsibility.

Earlier, Hamas said two of its men were killed after a tunnel they were digging from Gaza into Israel collapsed. Hamas identified the men, aged 35 and 23, as members of its militant wing.

The incident marks the second deadly tunnel accident in a week, after seven Hamas fighters died when heavy rainfall trapped them inside a tunnel.

Hamas leader Ismail Haniyeh, who last week said the tunnels were meant to attack Israel, on Wednesday softened his rhetoric, telling The Associated Press that the tunnels were "defensive tunnels to prevent any aggression on the Palestinian people."

Israeli troops entered Gaza during the 2014 war and destroyed dozens of sophisticated tunnels Hamas built to infiltrate Israel and carry out attacks. Hamas has since boasted that it is rebuilding the network, and Israelis living near Gaza have reported hearing tunneling sounds under their homes recently.

An Associated Press video shot Wednesday shows four machines appearing to drill on the Israeli side of the border. The Israeli military declined to comment on the video.

More than 2,200 Palestinians, including 1,462 civilians, were killed in the 2014 Gaza war. In Israel, 66 soldiers and seven civilians were killed.

On Sunday, Israeli Prime Minister Benjamin Netanyahu said Israel would retaliate with "greater force" than in 2014 if cross-border tunnels are used to attack Israelis.