An Indonesian high court has granted an appeal from prosecutors and sentenced an Islamic boarding school headteacher to death for raping at least 13 students over five years and making some of them pregnant.

Herry Wirawan had been convicted by a three-judge panel at Bandung District Court in February and sentenced to life in prison.

He had been accused of raping girls between 11 and 14 years old from 2016 to 2021 at the school, hotels or rented flats in the West Java city. At least nine babies reportedly were born as a result of the rapes.

The case caused a public outcry and police said the victims were too fearful to tell anyone.

The Bandung High Court judges in their ruling agreed with prosecutors’ appeal for the death penalty and for Wirawan’s assets to be seized.

“What he had done had caused trauma and suffering to the victims and their parents,” said the ruling the court released on its website on Tuesday.

“The defendant had tarnished the reputation of Islamic boarding schools.”

The lower court had ordered Indonesia’s child protection ministry to pay compensation requested by the victims and for medical and psychological treatment for each girl, instead of seizing Wirawan’s assets.

But the high court ruled his assets be seized, including a foundation he owned, and auctioned to benefit the victims and their children.

The judges also ruled that nine children born to the victims should be handed over to the Children and Women Protection Agency with periodic evaluation “until the victims are mentally ready to care for their children, and the situation allows for their children to be returned to the victims”.

Wirawan’s lawyer, Ira Mambo, said she would advise her client to appeal against the sentence to the Supreme Court. They have seven days to do so before the court decision becomes final.

Wirawan pleaded guilty and apologised to his victims and their families during the trial.

West Java police began to investigate the case and arrested Wirawan last May when parents of a victim went to the police after their daughter returned home on a holiday and said she had just given birth.