The chairman of Pennsylvania’s Republican Party abruptly resigned Tuesday after a news report that he sent a sexually explicit photograph of himself to a female candidate who ran unsuccessfully for the Philadelphia City Council.

The report, in The Philadelphia Inquirer, said that the chairman, Val DiGiorgio, sent the candidate, Irina Goldstein, a photo of his erect penis on Facebook Messenger after exchanging sexually tinged messages for a few months after she accepted his friend request last October.

Mr. DiGiorgio frequently commented about Ms. Goldstein’s appearance in those messages, which The Inquirer said ended in February when Ms. Goldstein accused Mr. DiGiorgio of sexual harassment.

“I extend my deepest apologies to my family and colleagues for this unfortunate distraction,” Mr. DiGiorgio wrote Tuesday in a resignation letter shared by the state Republican Party on its website.