Appearances to the contrary, Justice J. Michael Eakin wasn't horsing around.

The case before the state Supreme Court involved two men from rural Mercer County arrested for riding a horse on a public highway while drunk.

The men said Pennsylvania's motor vehicle laws were unconstitutionally vague, at least as they applied to their case, and asked that the charges be thrown out.

Eakin disagreed and in a dissenting opinion lapsed into verse, borrowing from the theme song of the 1960s television show, Mr. Ed.

"A horse is a horse, of course of course

But the Vehicle Code does not divorce

Its application from, perforce, a steed, as my colleagues said.

It's not vague I'll say until I'm hoarse, and whether a car, a truck or a horse this law applies with equal force," Eakin wrote, even as a majority of his fellow justices sided with the riders.

Eakin, who served on the court since 2002, was long known as its most approachable jurist. But the content of his emails - sprinkled with racist, misogynist, and ethnic insults - cost him his job Tuesday when he resigned, ending a 24-year career on the bench.

Eakin, 67, was set to be tried before the state's Court of Judicial Discipline on allegations that he violated judicial ethics rules by sending and receiving emails denigrating minorities, women, and others. He traded the messages among a small group of lawyers and golfing buddies from 2008 to 2014.

Many court watchers believed that Eakin faced long odds to stay in his seat. "It's hard to think of him continuing to sit in judgment of cases involving groups that he has disparaged," said Lynn Marks, executive director of Pennsylvanians for Modern Courts, a group pushing judicial reform.

The emails that Eakin sent from his state computer - 18 in all - ran the gamut, from tame to simply stupid to offensive, with bawdy jokes, pictures of women's breasts, sexually suggestive commentary on two women who work in his office, and disparaging commentary about President Obama.

Dozens of other emails received but not forwarded by Eakin were deemed just as offensive, if not more so, trading in racially charged, sexist, and homophobic humor. Eakin says he never opened the vast majority of these.

The man at the center of Pennsylvania's most recent judicial ethics storm is described by friends and lawyers who have practiced with him as a modest, sociable type with a self-deprecating sense of humor that puts others at ease.

He is an avid outdoorsman, traveling each year with his father to Alaska, where they go salmon fishing, and an avid golfer. A Republican who takes conservative positions, especially in criminal justice matters, Eakin utilized legal reasoning and scholarship generally drew praise from lawyers who argued before him.

His 2001 election to the state Supreme Court was hailed by the U.S. Chamber of Commerce, which said Eakin would balance a court that had become too closely aligned with plaintiffs' lawyers, and less focused on the needs of business.

"Mike is a conservative guy from a conservative part of Pennsylvania so he would be more pro-prosecution," said Northampton County District Attorney John Morganelli, a Democrat, who is running for state attorney general and has known Eakin for decades. Morganelli says he plays golf with Eakin at the Carlisle Country Club in Cumberland County and has never heard Eakin make a racist or sexist remark.

Eakin, who lives in Elizabethtown with his wife, Heidi, a lawyer who assisted in his defense, started his career in the Cumberland County District Attorney's Office in Carlisle after graduating from Dickinson Law School in 1975.

He was elected district attorney in 1984. Ten years later, he ran for Superior Court, one of the state's mid-level appellate courts, and won. He had made it plain to colleagues over the years that he planned to run for an appellate-level seat and personally argued appeals cases from his office to prepare for that day.

"He is a very down-to-earth, no-frills kind of guy," said former Supreme Court Justice William Lamb, who sat on the bench with Eakin in 2003 and 2004 and now practices law in West Chester.

How could a jurist viewed generally by the legal community as fair and competent become wrapped up in an email string that has brought disrepute not only on Eakin, but also the court?

"My own sense of this, knowing Michael the way I do, is that he was just sort of asleep at the switch and didn't think about the ramifications of what he was doing in today's world," Lamb said. "My own rule is never send an email that you would be embarrassed to show to your mother. We are very careful in our law office about that because once it is out there, it is out there."

Eakin had every reason to expect that his private exchanges would remain hidden. But that changed in late 2014 when state Attorney General Kathleen G. Kane released emails exchanged among members of the Supreme Court, lawyers in the Attorney General's Office, and others that contained sexually explicit material.

Former Supreme Court Justice Seamus McCaffery abruptly retired after it was disclosed that he had sent hundreds of pornographic emails. . The move allowed him to keep his pension and avoid an ethics inquiry.

Eakin was cleared in initial investigations by the Supreme Court and the Judicial Conduct Board, which found no violations, and only a handful of off-color communications.

But after Kane released a second batch of emails with new material in September 2015, suggesting that authorities had overlooked Eakin's improper conduct, the Judicial Conduct Board opened a second probe.

In December, the board charged Eakin with breaching the judicial ethics rules that require judges to "avoid impropriety and the appearance of impropriety."

Bruce Ledewitz, a Duquesne University law professor and an expert on the state Supreme Court, said that Eakin, or any justice, involved in a compromising email chain, could be blackmailed.

"People are horrified by these emails," he said. "They just don't like the idea that a judge thinks it is funny participating in the sending of an email that makes fun of a group protected by anti-discrimination laws. It shows insensitivity."

215-854-5957 @cmondics