SEOUL, South Korea — A former senior South Korean prosecutor was sentenced to two years in prison on Wednesday on charges of banishing a junior prosecutor to an obscure posting after she tried to expose his sexual misconduct.The case of the former senior prosecutor, Ahn Tae-geun, drew particular attention in South Korea because the accusations of the junior prosecutor, Seo Ji-hyeon, helped fuel a nascent #MeToo movement in this deeply male-dominated society.Ms. Seo recounted during an interview with a cable channel in January 2018 how she had been sexually molested by Mr. Ahn. Her decision to make public her accusations was an all but unprecedented move in South Korea, where victims of sexual violence have been afraid to speak out for fear of shame and retaliation.Ms. Seo’s action helped encourage a steady stream of women to come forward with accusations of sexual abuse against an array of prominent men, including theater directors, politicians, professors, Roman Catholic priests and a former national speedskating team coach. Many of the accused men have since apologized for sexual misconduct and resigned from their positions, several of them facing criminal charges.Lee Sang-ju, a presiding judge at the Seoul Central District Court, said in his verdict on Wednesday against Mr. Ahn that the former prosecutor had “used his influence to cover up his corrupt conduct and discriminated against the victim in job assignments rather than protecting her.”“He inflicted a psychological damage to his victim that is hard to heal,” the judge added.Mr. Ahn, who has denied the charges against him, said he would appeal the ruling.Once a rising star among elite prosecutors, Mr. Ahn was formally arrested shortly after the ruling on Wednesday and was taken to prison.His case became a tipping point in South Korea’s slowly developing #MeToo movement after Ms. Seo revealed in online postings and media interviews last year that he had groped her at a funeral in 2010. Mr. Ahn has said he had no recollection of the alleged episode because he was drunk at the time.Writing in an internal web log for prosecutors, Ms. Seo said she had been so deeply traumatized by the abuse that she had a miscarriage. But she said that when she lodged a formal complaint and an internal audit began, Mr. Ahn used his influence to have her assigned to an obscure posting in a small provincial city.Mr. Ahn had headed an office at the Justice Ministry that supervised job postings of prosecutors before he was forced to resign in 2017 in a corruption scandal.Ms. Seo said she had remained silent for years before finally gathering enough courage to speak out. When she did, she received a wave of public support, forcing the Justice Ministry to open an investigation.The ruling on Wednesday was a victory for #MeToo campaigners in South Korea.Their campaign was dealt a significant setback last April when a court acquitted Ahn Hee-jung, a prominent former provincial governor and presidential hopeful, of repeatedly raping a female aide. The court cited a lack of evidence that Mr. Ahn had coerced his accuser into a sexual relationship.