PHILADELPHIA — A Pennsylvania pastor who broke church law by presiding over his son’s same-sex wedding ceremony and then became an outspoken activist for gay rights can return to the pulpit after a United Methodist Church appeals panel on Tuesday overturned a decision to defrock him.

The nine-person panel ordered the church to restore Frank Schaefer’s pastoral credentials, saying the jury that convicted him last year erred when fashioning his punishment.

“I’ve devoted my life to this church, to serving this church, and to be restored and to be able to call myself a reverend again and to speak with this voice means so much to me,” an exultant Schaefer told The Associated Press, adding that he intends to work for gay rights “with an even stronger voice from within the United Methodist Church.”

The church suspended Schaefer, of Lebanon, Pennsylvania, for officiating at his son’s 2007 wedding, then defrocked him when he refused to promise to uphold the Methodist law book “in its entirety,” including its ban on clergy performing same-sex marriages.

Schaefer appealed, arguing the decision was wrong because it was based on an assumption he would break church law in the future.

The appeals panel, which met in Linthicum, Maryland, last week to hear the case, upheld a 30-day suspension that Schaefer has already served and said he should get back pay dating to when the suspension ended in December.

Bishop Peggy Johnson of the church’s eastern Pennsylvania conference said Tuesday she will abide by the panel’s decision and return him to active service.

The ruling can be appealed to the Methodist church’s highest court. The pastor who prosecuted Schaefer, the Rev. Christopher Fisher, said he has not made a decision about an appeal.

“I’m still in prayerful consideration about that,” said Fisher, calling Tuesday’s decision “not entirely unexpected.”

At a news conference in Philadelphia, Schaefer said he expects to take a job with the Methodist church in California, a liberal bastion where there is presumably little chance he would be punished for defying church doctrine on homosexuality.

The issue of gay marriage has long roiled the United Methodist Church, the nation’s second-largest Protestant denomination.