A Michigan appeals court overturned a ruling on Wednesday that had sent a minister to prison for six months after warning a judge that he could be tortured by God.

The Rev. Edward Pinkney was convicted in 2007 of paying people $5 to vote in a recall election in the southwestern Michigan city of Benton Harbor and was sentenced to probation.

Months later, Pinkney wrote a commentary in a Chicago-based populist newspaper that said Judge Alfred Butzbaugh could be punished by God with curses, fever and "extreme burning" unless he repented, a reference to an Old Testament passage. The black minister also described Butzbaugh, a white judge who presided over his case, as dumb, racist and corrupt.

In June 2008, another Berrien County judge sent Pinkney to prison for three to 10 years for violating probation with his words. Pinkney appealed saying his free-speech rights were trampled.

In a 3-0 ruling, the Michigan Court of Appeals agreed.

Judges can restrict First Amendment rights as a condition of probation, but the order must be "narrowly drawn to protect the public from a situation that might lead to a repetition of the same crime," the court said.

In Pinkney's case, the court said, a probation rule barring defamatory or demeaning statements against anyone went too far.

"This is a thrilling victory, one for the people," Pinkney said from his home in Benton Harbor. "I'm so happy I don't even know what to tell you."

The American Civil Liberties Union, which represented Pinkney on appeal, also welcomed the decision.

"To our knowledge, this case marks the first time in modern history that a preacher has been thrown in prison for predicting what God might do," said Michael Steinberg, legal director at the ACLU of Michigan.

A coalition of religious groups also had urged the appeals court to throw out the probation violation.

"Our brief was on how ridiculous this was," attorney Douglas Laycock said. "What (Pinkney) was doing was in a tradition of speech fairly common among evangelical Christians."

A message seeking comment was left with the county prosecutor's office, which opposed Pinkney's appeal.

Pinkney has been on house arrest with an electronic tether since December when the appeals court released him while considering his case.

While in prison in 2008, he received 3,500 votes as the Green Party candidate for Congress in Michigan's 6th District.