A Palestinian rammed his truck into a group of Israeli soldiers on a popular promenade in Jerusalem, killing four of them in an attack that Prime Minister Benjamin Netanyahu said is likely to have been inspired by the so-called Islamic State.

It was the deadliest Palestinian attack in Jerusalem in months and targeted officer cadets as they disembarked from a bus that brought them to the Armon Hanatziv promenade, which has a panoramic view of the walled Old City.

The military said that a female officer and three officer cadets were killed and that 17 others were injured. Police said three of the dead were women.

Police identified the truck driver as a Palestinian from Israeli-annexed East Jerusalem and said he was shot dead.

His uncle, Abu Ali, named him as Fadi Ahmad Hamdan Qunbor, 28, a father of four from the Jabel Mukabar neighbourhood.

Police spokesman Micky Rosenfeld said that nine Jabel Mukabar residents, including five members of the attacker's family, were arrested on suspicion of aiding the attacker.

The Israeli military regularly takes soldiers on educational tours of Jerusalem, including the Armon Hanatziv vantage point.

Mr Netanyahu visited the scene and convened his security cabinet, a forum of senior ministers, to discuss Israel's response. He said that security forces were controlling access in and out of the neighbourhood.

"We know the identity of the attacker. According to all the signs he is a supporter of Islamic State," the prime minister said.

A government source said that ministers had called for the demolition of the attacker's home and for his body not to be returned to the family for burial. It also decided to detain without trial persons expressing sympathy for IS.

Roni Alsheich, the national police chief, told reporters he could not rule out that the driver had been motivated by a truck ramming attack in a Berlin Christmas market that killed 12 people last month.

"It is difficult to get into the head of every individual to determine what prompted him, but there is no doubt that these things do have an effect," Mr Alsheich told reporters.

In another attack claimed by IS and involving a truck driven into a crowd, nearly 90 people were killed in the French city of Nice in July.