Pennsylvania Supreme Court Justice Seamus P. McCaffery stepped down Monday, nearly a month after becoming entangled in a pornographic e-mail scandal that has toppled other state officials, and facing an ethics investigation that could have cost him his seat and pension.

In a two-paragraph letter, the 64-year-old Philadelphia Democrat told Gov. Corbett that he was retiring after 40 years in public service, including six as a justice. "It has all been a great honor and privilege, which I deeply cherish," he wrote.

McCaffery became the second justice in as many years to depart under a cloud. His abrupt retirement also marked the end of a bitter public war with Chief Justice Ronald D. Castille, who had pushed for the Judicial Conduct Board to investigate McCaffery.

And it followed a weekend of intense secret negotiations, in which McCaffery agreed to leave his $200,000-a-year job three years before his term ended and not seek any other elective office as long as his government pension stayed intact, sources said.

From his tenure as a Philadelphia police officer, Municipal Court judge, and justice, McCaffery stands to collect at least $155,000 a year in retirement, state records indicate.

In return, the Judicial Conduct Board said it would halt its inquiry into allegations that he had improperly given his wife - his judicial aide - permission to accept payments for making case referrals to lawyers. The board was also looking into allegations that he meddled in court cases, fixed a ticket on his wife's behalf, and, most recently, sent sexually explicit e-mails to the government accounts of state employees.

"Since Justice McCaffery has retired and has agreed not to seek senior judge status and not to again seek elective judicial office, the board has concluded that it is in the best interest of the judiciary and the judicial system of the commonwealth to dismiss its investigations," the board said in a statement.

The 11 Judicial Conduct Board members were polled over the weekend, sources said.

McCaffery was not available for comment Monday, according to a spokesman.

A native of Northern Ireland and a self-described "character" from the city's Bustleton neighborhood, he first gained fame as a judge presiding over "Eagles court" for unruly fans at Veterans Stadium. But he had made no mistake about his ambition.

"My ultimate goal? The Pennsylvania Supreme Court would be my ultimate goal," he said in a 2001 interview.

Six years later, he won a 10-year term on the bench.

His retirement ends a short but explosive chapter in the court's history that longtime observers - and the chief justice - said hurt its reputation and integrity.

"I'm glad that there was a swift resolution to this matter and it did not drag out, possibly for years," Castille, 70, who faces mandatory retirement at the end of the year, said Monday. "I won't be there, but this will be a time for the court to rebuild its reputation after all this drama."

Last year, Justice Joan Orie Melvin was removed after being convicted of conspiracy, misappropriation of funds, and theft for using state resources to run her campaigns.

The departures of Orie Melvin, McCaffery, and Castille set the stage for a highly charged election next year, one that could change the court's balance of power. The Supreme Court currently has four Republican justices and, with McCaffery's departure, two Democrats.

Corbett would not say Monday when or if he intends to nominate someone to fill McCaffery's term, which was to end in 2017. Anyone he does nominate would serve on the court through next year's election.

Asked about McCaffery on Monday, Corbett said: "We all have the right to retire. . . . He has exercised his." Referring to the uproar over pornographic e-mails, Corbett did say that McCaffery's resignation "continues to show that people made mistakes in judgment, and they are paying the price for the mistakes in judgment."

The scandal erupted last month, when Democratic Attorney General Kathleen G. Kane revealed the names of eight men who she said exchanged sexually explicit e-mails on their government accounts when they worked for her Republican predecessors between 2008 and 2012.

Five have since lost their jobs, including several top appointees in the Corbett administration.

Kane did not name McCaffery. But Castille pressed her office to give him the names of any judges or judicial employees who may have sent or received explicit images and videos.

She complied and Castille, a Republican, released findings that showed McCaffery had sent or received more than 230 e-mails that included sexually explicit content between late 2008 and mid-2012, including messages sent to at least one state e-mail account of a government employee. The messages included photographs and videos of scantily clad or naked women engaged in sex acts, including one with a snake.

McCaffery used a private e-mail address to receive or send the messages, but Castille said the justice may have still violated judicial conduct rules.

McCaffery apologized for offending anyone by what he called personal and private e-mails among friends. But he also contended that Castille was seeking to smear him because of a personal vendetta.

The saga turned uglier when it emerged that Justice J. Michael Eakin, the appointed liaison to the Philadelphia courts, had received three pornographic and potentially racially tinged e-mails on an anonymous private account.

Eakin blamed McCaffery for leaking the e-mails and all but accused McCaffery of blackmailing him because Eakin would not come to McCaffery's defense.

McCaffery denied the allegations.

Still, his colleagues on the court voted last week to suspend him with pay while the conduct board examined his role in those matters and others.

The negotiations over the weekend were carried out primarily by Robert Byer, the Pittsburgh lawyer named by the high court last week as its liaison to the conduct board, and William Winning, the veteran Philadelphia criminal defense lawyer who has been the lead lawyer representing McCaffery.

As part of the deal, McCaffery and his wife, Lise Rapaport, as well as Castille, reached a non-disparagement agreement.

Rapaport is also to leave state employment. Under court rules, a justice's entire staff departs once a justice leaves.

U.S. Rep. Robert Brady, chairman of the Philadelphia Democratic Party, said McCaffery called him Monday morning to tell him that he was announcing his retirement.

"He said it would cost a whole lot of money, personal money, to fight it, and he didn't want to be on a court that had turned its back on him," Brady said. "He didn't want to be a part of a court that wouldn't support him."

Bruce Ledewitz, a law professor at Duquesne University, said McCaffery's resignation would spare the court further embarrassment, but "sweeping this under the rug" was not the best outcome for the public.

"We will never know what Justice McCaffery did or did not do," he said. "Or whether this whole episode was the result of personal enmity by Justice Castille, as Justice McCaffery said it was."

Text of McCaffery's Letter

Dear Governor Corbett:

After more than twenty years serving the citizens of our great commonwealth as a jurist, I have decided to retire as a justice of the Supreme Court of Pennsylvania. I am very proud of my twenty years of public service to the citizens of Philadelphia as a member of the Philadelphia Police Department, and my twenty years of service as a jurist, especially my service as a justice of the Supreme Court. It has all been a great honor and privilege, which I deeply cherish.

My retirement is effective immediately. In light of my immediate intention to embark on other professional endeavors and paths, I want to make clear that under no circumstances would I request or agree to take senior status in the Pennsylvania judicial system, nor would I ever be a candidate for appointment or election to any Pennsylvania judicial office in the future.

Sincerely yours,

Seamus P. McCaffery

EndText

717-787-5934 @AngelasInk

Inquirer staff writers Mark Fazlollah, Thomas Fitzgerald, and Maria Panaritis contributed to this article.