Voters have selected York County District Attorney Dave Sunday, a Republican, to be the state’s next prosecutor, according to a vote-tally early Wednesday from the Associated Press.

Sunday, 49, a Republican, emphasized his prosecutorial experience in the campaign against Democrat Eugene DePasquale, a former state representative and two-term auditor general. The attorney general oversees hundreds of lawyers.

Sunday is serving in his second term as York County’s district attorney and has served as a prosecutor for 15 years. Before becoming district attorney, Sunday rose to become the office’s chief deputy prosecutor and supervised major crime cases and the felony narcotics unit.

Pittsburgh native DePasquale, 53, a Democrat, previously served two terms as Pennsylvania’s auditor general and three terms as a state representative. As auditor general, he drew attention to a large backlog of untested rape kits, unanswered calls to Pennsylvania’s ChildLine child abuse hotline and nursing home conditions.

As of 5 a.m., Sunday had collected 51.16% of the votes, compared to 45.86% for DePasquale, according to unofficial results. Robert Cowburn, a Libertarian, had collected nearly 1.29% of the votes counted to lead the race’s four third-party candidates, the tallies showed.

More than 6.5 million ballots have been counted in that race so far, according to the Pennsylvania Department of State.

The row-house post came open because Attorney General Michelle Henry did not seek election after being appointed to fill the last two years of now-Gov. Josh Shapiro’s unexpired term.

Sunday has promised to “enforce and defend the abortion laws in Pennsylvania,” arguing during a recent debate that there is “no scenario that exists” where he would prosecute a woman for having an abortion. Many of Sunday’s Republican supporters favor an abortion ban, and DePasquale noted GOP state lawmakers tried to push through a constitutional amendment saying it does not guarantee any rights relating to abortion or public funding of abortions.

Sunday said that in the “most sad, tragic, terrible cases” he supports capital punishment.

The Associated Press contributed.