Image caption William Lynn was secretary for clergy in Philadelphia from 1992 to 2004

Roman Catholic Church official William Lynn has had his conviction for child endangerment reversed by a court in the US city of Philadelphia.

Monsignor Lynn was the first US Church official to be convicted in a criminal court for covering up sex abuse claims.

He was sentenced in 2012 to three to six years in prison but could now be released as early as Thursday.

The court said it had not been proven Mr Lynn had acted with the "intent of promoting or facilitating the crime".

'Unfair imprisonment'

Philadelphia's District Attorney Seth Williams said he was likely to appeal against the decision.

Prosecutors argued that Monsignor Lynn had endangered the welfare of a child by reassigning a priest with a history of sexual abuse to a parish in Philadelphia which was unaware of his past.

As secretary for clergy for the Archdiocese of Philadelphia from 1992 to 2004, Monsignor Lynn was in charge of supervising about 800 priests, including investigating sex abuse claims.

Monsignor Lynn admitted during his trial that he was aware of a complaint dating back to the 1990s that the priest, Edward Avery, had sexually abused an altar boy.

Mr Lynn helped Avery get treatment. But years later, he reassigned the priest to the Philadelphia parish where Avery again sexually assaulted an altar boy.

Avery later pleaded guilty to assaulting the 10-year-old and is currently in jail.

On Thursday, the appeals court rejected the prosecutors' argument that Monsignor Lynn had supervised the welfare of any particular child.

Mr Lynn's lawyer successfully argued that under the laws in effect when the monsignor held his post, he could not have been held responsible for the welfare of Avery's victim as that role only fell to parents and caregivers, not to supervisors like Mr Lynn.

The law was amended in 2007 to include the people supervising the child.

Mr Lynn's lawyer said the appeal court's ruling demonstrated he should never have been prosecuted.

"He's been in prison 18 months for a crime he didn't commit and couldn't commit under the law,'' the lawyer said.

Philadelphia is the sixth largest US archdiocese, with 1.5 million members.

Child sex abuse cases across Roman Catholic churches in the US have cost billions in settlements, driving some US dioceses into bankruptcy.