ISLAMABAD, Pakistan — The Pakistan Supreme Court on Wednesday overturned the acquittal of a man accused of stabbing a woman 23 times, nearly three years after the attack prompted a national debate on violence against women.

Chief Justice Asif Saeed Khosa, leading a three-member panel, reinstated the conviction of Shah Hussain, accepting an appeal from Khadija Siddiqi, who survived the attack in Lahore in May 2016. Ms. Siddiqi said that Mr. Hussain, a former classmate, had attacked her after she rebuffed his romantic overtures. Mr. Hussain was rearrested in the courtroom on Wednesday.

Ms. Siddiqi, a 24-year-old law student, said on Wednesday that she felt vindicated by the court’s decision.

“Today is a victory for all women,” she said. “I think this case will serve a steppingstone for the future cases of women in Pakistan.”