The Attorney General's Office has been disgraced and demoralized by the conviction in August of its former leader, Kathleen Kane, on perjury, obstruction, and other charges. The attorney general elected in November will face the herculean task of rebuilding the office and regaining the public's trust that justice will be carried out without fear, favor, or politics.

Fortunately, there are two well qualified candidates in Josh Shapiro, a Democratic Montgomery County commissioner, and Republican State Sen. John Rafferty, also of Montgomery County.

Since being elected to the Senate in 2003, Rafferty, 63, has stood out as one of the more level-headed lawmakers in Harrisburg. In 2013 he spearheaded passage of Act 89, which increased the gas tax and motorist fees to fund road and bridge repairs and public transportation improvements. Three years later, Rafferty authored Act 33, which strengthened drunk-driving laws.

Rafferty also has experience as a prosecutor, having served as a deputy attorney general from 1988 to 1991, focused mainly on Medicaid fraud. But one huge drawback to Rafferty's candidacy is his A rating by the National Rifle Association. The NRA likes Rafferty because he opposes letting cities like Philadelphia, which are plagued daily by shootings, develop reasonable local gun measures.

Rafferty prefers to leave gun control to the state, but the state's one-size-fits-all approach doesn't help cities that need every tool possible to combat gun violence. Moreover, Pennsylvania doesn't need an attorney general in league with the gun lobby.

Shapiro instead favors beefing up the Gun Violence Task Force, expanding background checks, and cracking down on illegal sales at gun shows.

Shapiro has a number of other thoughtful policy proposals to reduce crime and protect average citizens. He wants to combat opioid addiction, protect senior citizens from financial scams, and prosecute fracking operations that break environmental laws.

The most impressive aspect of Shapiro's candidacy is his thoughtful plan to repair the Attorney General's Office after seeing Kane convicted of a crime. He wants to establish a new code of conduct for the department so it is crystal clear what behavior won't be tolerated.

Shapiro also has detailed plans to crack down on public corruption, which include a gift ban for all public officials, increased funding for the state ethics commission, and stiffer penalties in corruption cases. Of course, all of these proposals are just talk if Shapiro does not follow through on them, but he has a track record of doing just that.

Shapiro, 43, became chief of staff to U.S. Rep. Joe Hoeffel when he was 26. He was elected to the state House at age 31, and served until he joined the Montgomery County Commission in 2012. One fear is that if elected attorney general, he will soon be eyeing a higher office. His name has been mentioned as a candidate for governor or Congress.

Pennsylvania needs an independent attorney general who will restore integrity to the office, protect average citizens, and won't let politics get in the way of upholding the law. One candidate is better prepared to carry out that job. The Inquirer endorses JOSH SHAPIRO.