Palestinian teenage protester Ahed Tamimi has been sentenced to eight months in prison for slapping and kicking a pair of Israeli soldiers outside her West Bank home.

The sentence capped a case that sparked uproar in Israel, turned the 17-year-old girl into a Palestinian hero and attracted international attention.

Tamimi’s Israeli lawyer, Gaby Lasky, said she agreed to the sentence as part of a plea deal with prosecutors that allowed her to avoid more serious charges that could have imprisoned her for years.

Under the deal, she is due to be released in the summer. She is also being fined the equivalent of about £990.

Ms Lasky called the legal proceedings a “farce”. She said “they are trying to deter other Palestinian youth from resisting occupation as Ahed did”.

The judge agreed to a similar plea deal for Tamimi’s mother Nariman, who has been charged with incitement.

“This is injustice, this court is designed to oppress the Palestinians,” her father Bassem said.

He said they agreed to the deal because they had been threatened with three years in jail.

Bassem had visited his daughter and wife for the first time in prison the day before. He said Ahed spends her time doing school work.

An Israeli supporter of Tamimi slapped a prosecutor after the ruling and was later arrested by police.

Tamimi was arrested in December after video surfaced of her kicking the soldiers outside her West Bank home.

While some praised the soldiers for showing restraint, hard-line politicians criticised what they felt was a weak response and called for tough action against the girl, whose family has a long history of run-ins with the Israelis.

But the full-throttle prosecution of Tamimi, who turned 17 behind bars, has drawn widespread international criticism.

An Israeli official’s revelation that he had once had parliament investigate whether the blond, blue-eyed Tamimis are “real” Palestinians drew accusations of racism and helped stoke additional interest in the case.