A 12-year-old Palestinian girl who confessed to planning a stabbing attack in a West Bank settlement has been freed after more than two months in an Israeli prison.

Israeli Prison Service spokesman Assaf Librati said Dima al-Wawi was sent her home to her village near Hebron in the West Bank.

She is believed to be the youngest female Palestinian ever imprisoned. Her case put Israel's military justice system in the spotlight. It came amid seven months of near-daily Palestinian attacks against Israeli civilians and soldiers.

According to court documents, the girl was caught with a knife as she approached an Israeli settlement in February.

She later pleaded guilty to attempted manslaughter in a plea bargain and was sentenced to four months in prison. She was freed early after an appeal.