Philadelphia Judge Patrick Dugan was elected as president judge of the Philadelphia Municipal Court following an election that was marred by a racist, misogynist and threatening letter sent to one of the candidates. Where the letter came from is being investigated by law enforcement.

Dugan was elected Thursday afternoon by his fellow municipal court judges with a total of 18 votes. Municipal Court Judge Charles Hayden received five votes, and Municipal Court Judge Karen Y. Simmons received three votes.

Dugan, a Democrat, was appointed to the bench in 2007, and was elected to a full term in 2009. He also served as chief judge of Philadelphia's Veterans Court. He is replacing current President Judge Marsha Neifield.

Dugan did not immediately return a call for comment on his election victory Thursday evening.

Dugan was recently assigned the high-profile homicide case against Philadelphia Police Officer Ryan Pownall, but stepped aside from that case in September for procedural reasons.

Although elections for the municipal court judge is usually a quiet process, the race was marred by a letter that Simmons, who is black, found Tuesday. The message was found in an envelope for intra-office mail in her robing room at the Criminal Justice Center. The message, according to the Courier Express and The Philadelphia Inquirer, said “THERE WILL NEVER BE A BLACK BITCH RUNNING OUR COURT. YOU WON'T BE PRESIDENT JUDGE!!!” It ended with “KEEP MC COURT GREAT!”

Hayden is also black, and Dugan is white.

There was no word on who might be responsible for the letter and there was no indication that any of the candidates were involved in any way.

Simmons said Thursday afternoon that finding the letter felt like “a sucker punch.”

“It was shock. I never would have thought this would happen to anyone in 2018, and for sure not anyone in Philadelphia in 2018,” she said. “I figured whoever did it, if they thought they were going to sway [the president judge election] then they didn't know me. It was hurtful and disappointing, but I was never going to drop out of this race.”

In a statement to the press, Gabriel Roberts, spokesman for the First Judicial District, said that the court is cooperating with law enforcement as it investigates the incident.

“The court is fully cooperating with this investigation by law enforcement into discovering the individual or individuals behind the egregious racist and hateful comments directed toward one of our judges,” Roberts said. “The offensive and intolerable nature of this document is a violation of everything this court promotes and stands for and it will not be tolerated. The court will take all appropriate action upon the conclusion of this investigation.”

In a tweet, Benjamin Waxman, spokesman for the Philadelphia District Attorney's Office, said the office was aware of the “apparent threat” and is working with law enforcement partners to investigate the incident as well.

Luz Cardenas, a spokeswoman with the Philadelphia Sheriff's Office, confirmed that the office is also investigating the incident.

An earlier version of this story incorrectly identified the reason for Dugan reassigning the Pownall case to another judge.