JERUSALEM — Two Israeli soldiers using the navigation app Waze were attacked by an angry mob Monday after accidentally driving through the Palestinian city of Jenin in the northern West Bank.

The incident was confirmed by the Israeli military, which said rocks were hurled at the car, which was clearly marked as an army vehicle. A weapon was stolen from one soldier, and one soldier was injured lightly, the army said in a statement.

The army said it was investigating the incident.

A graphic video of the incident shows the two soldiers — one male and one female — inside the car as a large group of Palestinians surrounds it, shouting. Within seconds, the car’s windows are smashed and those involved in the attack can be seen reaching inside the car, grabbing and pulling hard at the female soldier’s hair.

A military source said the soldiers had been using Waze, a highly touted, Israeli-invented navigation app bought by Google a few years ago. The smartphone app relies on crowdsourcing to give users the most updated traffic routes. It also has a setting to “avoid dangerous areas.”

When the “dangerous areas” setting is enabled, Israeli drivers receive multiple warnings that they are entering areas A and B in the West Bank. Area A is under full Palestinian security control and is considered highly dangerous by Israeli authorities.

“It still happens about once a week,” said the military source, who spoke anonymously to discuss the incident more openly. “Sometimes it is soldiers, sometimes Israeli civilians, sometimes they are using Waze, sometimes they just end up in these areas by mistake.”

And each case ends differently, said the source. Many times, Palestinian security forces help escort the Israelis out of the Palestinian areas and hand them over to Israeli authorities.

In the video of Monday’s incident, a Palestinian policeman can be seen  tapping on the window and talking to the soldiers. He also tells the crowd to take it easy.

Two years ago, a similar incident prompted a gun battle at the Palestinian refugee camp of Qalandiya, near Ramallah. Two soldiers had entered the area by mistake, and Israeli forces were sent to rescue them.