TEL AVIV, Israel -- An Israeli military court on Tuesday sentenced a soldier to 18 months in prison for his deadly shooting of a Palestinian attacker who lay wounded on the ground, capping a nearly yearlong saga that has deeply divided the country.

The sentence, which included a year’s probation and a demotion in rank, was lighter than expected. Prosecutors had asked for a prison term of three to five years. Palestinians dismissed the sentence as a “joke.”

Yet it still triggered disappointment from several hundred protesters who had gathered outside the Tel Aviv court and had hoped to see the soldier walk free. Sgt. Elor Azaria is to start serving his term on March 5, and politicians immediately called for him to be pardoned.

Get Breaking News Delivered to Your Inbox

“Even if he erred, Elor should not sit in prison. We will all pay the price,” said Education Minister Naftali Bennett, leader of the nationalist Jewish Home Party and an early supporter of the soldier.

The Palestinians, meanwhile, said the light sentencing only encouraged Israeli soldiers to use excessive force.

“This sentence is a joke, and it shows how much discrimination Israeli courts practice against Palestinians,” said Issa Karaka, the Palestinian government minister for prisoners.

Azaria was convicted of manslaughter last month in a rare case of a military court ruling against a combat soldier for lethal action taken in the field.

The verdict marked a victory for commanders who said Azaria had violated the army’s code of ethics. But the soldier himself generated great support among the public, many of whom see him as a scapegoat for a misguided elite that has sought to harshly punish a soldier who they say responded to an armed attacker trying to kill other soldiers.

Azaria, an army medic, was caught on a cellphone video last March as he fatally shot the wounded Palestinian, just after the man stabbed a soldier in the West Bank city of Hebron. The Palestinian, Abdel Fattah al-Sharif, was lying on the ground badly wounded and already unarmed when Azaria shot him in the head.

The dead Palestinian’s father, Yousri al-Sharif, said the light sentence made a mockery of justice. “If one of us killed an animal they would have put him in jail for God knows how long. They are only making fun of us,” he said.

Fathi al-Sharif, an uncle of the slain attacker, said the sentence was too light. “It’s not a punishment,” he said. “This will encourage other soldiers to do the same.”

The sister (L) of Palestinian Abdul Fatah al-Sharif, who was shot dead as he lay on the ground by Israeli soldier Elor Azaria in March 2016, takes part in a demonstration against the verdict of the trial, in the occupied West Bank city of Hebron, on February 21, 2017. HAZEM BADER/AFP/Getty Images

The shooting occurred at the height of what has become more than a yearlong wave of Israeli-Palestinian violence. Since September 2015, Palestinian attackers have carried out numerous stabbing and shooting attacks that have killing 41 Israelis and two visiting Americans. During the same time, Israeli forces have killed 235 Palestinians, most of them attackers.

Palestinians and human rights groups have accused Israeli forces of using excessive force in some of the cases and even harming innocent people mistaken as attackers. But in the absence of concrete evidence, they have been unable to prove these claims. The video of the Azaria shooting, taken by a Palestinian human rights activist, was the strongest evidence to date to support the Palestinian claims.

“Sending Elor Azaria to prison for his crime sends an important message about reigning in excessive use of force,” said Sari Bashi, Israel and Palestine Advocacy Director at Human Rights Watch. “But senior Israeli officials should also repudiate the shoot-to-kill rhetoric that too many of them have promoted, even when there is no imminent threat of death. Pardoning Azaria or reducing his punishment would only encourage impunity for unlawfully taking the life of another person.”

Azaria’s defenders said he shot the assailant in self-defense, and hard-line politicians have said he should be either cleared or released with a light penalty.

“The prosecution was thirsty for Elor’s blood and the sentencing proves that,” Yoram Sheftel, one of the soldier’s lawyers, said outside the court.

But his detractors, including senior military commanders, have said his actions violated military procedures.

The uproar has put the army in a delicate position.

Military service is compulsory for Israel’s Jewish majority, and there is widespread sympathy for soldiers, since virtually every family has a member who is serving or has served in the past.

Prime Minister Benjamin Netanyahu, who initially defended the military, later softened his position and called Azaria’s parents to console them. After the verdict last month, he called for Azaria to be pardoned.

The dispute helped fuel the resignation of Defense Minister Moshe Yaalon, a former military chief who sided with the army.

His successor, Avigdor Lieberman, visited Azaria in court during the trial. But since taking up the defense post, Lieberman has lined up behind the army. On Tuesday, he asked the public to respect the sentencing and urged “all sides to do what is necessary to put an end to this affair.”

Netanyahu was on a trip to Singapore and Australia and did not immediately react to the sentencing.

Dozens of the soldier’s supporters outside the court chanted words of encouragement and waved banners reading: “Death to terrorists.”

The 20-year-old Azaria entered the court smiling and was greeted by applause from friends and relatives. He then had a long embrace with his mother and other family members.

Last month’s verdict was accompanied by angry outbursts in the courtroom and protesters outside who briefly blocked streets and scuffled with police.

But reactions were more muted Tuesday as Azaria’s father, Charlie, took a more calming approach, asking supporters ahead of the sentencing not to disrupt the proceedings.

“None of us have any expectations, we shall accept the sentence whatever it may be,” he said.

The family sang the national anthem at the end of sentencing.

Outside the courtroom there was anger, but no major disturbances.

“I’m a mother of soldiers, of fighters just like him. How can I send my kids to the army now?” said Sigalit Cohen, an Azaria supporter. “You are a soldier, you have a gun, you are a fighter, that’s your job. He only did his job.”

Col. Maya Heller, head of the three-judge panel, noted as mitigating factors in Azaria’s sentencing that the incident took place “in hostile territory” and it was Azaria’s first real operational experience.

“We took note of the harm suffered by his family,” she said.

However, she said Azaria had not expressed remorse for his actions and ruled that he did not open fire out of danger -- but rather to harm the assailant.