Two Israelis have died after an attack by a Palestinian in the occupied West Bank on Sunday, Israeli officials say.

The military said a man stabbed to death a soldier at an intersection near the Jewish settlement of Ariel before stealing his rifle and shooting a civilian and another soldier.

The civilian died of his injuries on Monday while the second soldier remains in a serious condition in hospital.

Israeli forces are searching for the attacker, who fled the scene in a car.

Roadblocks have been set up around several nearby Palestinian villages and settlements have been told to keep their gates closed.

Israeli military spokesman Lt Col Jonathan Conricus said Sunday's incident began at about 09:45 (07:45 GMT), when the attacker stabbed a soldier near the Ariel Junction and seized his assault rifle.

He then opened fire at three passing vehicles, hitting a civilian in the first vehicle, Col Conricus added. The second vehicle was hit but continued moving. The third car stopped and the attacker hijacked it.

He then drove to the nearby Gitai Avishar Junction, where he shot a soldier standing at a hitch-hiking post.

From there, the attacker drove to the Palestinian village of Bruqin, abandoned the vehicle and fled on foot, Col Conricus said.

Later on Sunday, the Israeli military confirmed that the soldier stabbed at Ariel Junction had died, naming him as Staff Sgt Gal Keidan, 19, from the southern Israeli town of Beersheba.

It added that the soldier shot at Gitai Avishar Junction was in a serious condition. He reportedly suffered wounds to his stomach.

On Monday morning, Israeli medical authorities in Petah Tikva, a city east of Tel Aviv, said the civilian who was shot in the car at Ariel Junction had died of his wounds. He was named as Rabbi Ahiad Ettinger, a 47-year-old father of 12 from the settlement of Eli, east of Ariel, and head of a religious seminary in Tel Aviv.

The rabbi's family said that he had opened fire at the assailant before he was shot and that he had "prevented a greater terror attack from occurring".

"Rabbi Ettinger's life's work will continue and be amongst us even after his passing, and the strength he gave his pupils and the community he led will continue to strengthen us through the enormous grief and sorrow," said Israeli President Reuven Rivlin in a statement.

The Israeli military identified the attacker as Omar Amin Abu Lila, a 19-year-old resident of the West Bank village of al-Zawiya with no known associations with any militant group.

The Palestinian Islamist movement Hamas, which dominates the Gaza Strip, did not say it was behind the attack but called it a "natural response to crimes committed by the Israeli occupation".

More than 50 Israelis have been killed since late 2015 in a series of stabbings, shootings and car-ramming attacks, predominantly by Palestinians or Israeli Arabs.

More than 260 Palestinians have also been killed over the same period. Most have been assailants, Israel says. Others have been killed in clashes with Israeli troops.