ASSOCIATED PRESS File photo of Daniel McGowan sitting on the steps at his home in Brooklyn in June 2007.

NEW YORK -- A blogger who wrote for The Huffington Post while serving a federal prison sentence didn't have a First Amendment right to publish an article critical of prison conditions, an appeals court has ruled.

Daniel McGowan, an environmental activist whose prosecution for "eco terrorism" was the subject of an award-winning film, was finishing his seven-year term at a Brooklyn halfway house when he wrote a HuffPost blog post that contained details about a secretive prison where he had spent years in isolation.

There was nothing particularly revealing about what he wrote: Much of it had been made public in an ongoing civil rights lawsuit he and other low-risk prisoners filed in federal court in Washington challenging their placement there, for no other reason than their political views or who they are.

A prison official took note of the blog post and decided to punish McGowan by transferring him from the halfway house -- which allowed him to live a semi-normal life of work and home visits on weekends -- and placing him in solitary confinement at a detention center in Brooklyn.

But the prison official seemingly got it wrong. The rule she thought McGowan had broken, which prohibited federal inmates for publishing bylined articles, had actually been rescinded by the Bureau of Prisons because a federal judge had found it unconstitutional years earlier.

That meant McGowan, 42, had been free to blog for HuffPost all along.

After his lawyers notified the prison about the rescinded rule, prison officials scrapped the violation and returned McGowan to the halfway house. A year later, the activist-cum-prisoner-cum-blogger filed his lawsuit against prison officials and the federal government, alleging his First Amendment rights had been violated.

The U.S. Court of Appeals for the 2nd Circuit tossed McGowan's lawsuit earlier this week, essentially ruling that, as a federal inmate, he had no "clearly established right" to publish what he did in 2013.

In constitutional speak, this is a big dodge. All it means is that the court couldn't find any controlling court decisions at the time McGowan published his piece that made it crystal clear to unwitting prison officials that he had an unassailable right to write a bylined article.

But there's more. As a result of this "absence of authority," the court said the prison official who put McGowan back in the hole was deserving of qualified immunity -- a controversial doctrine that has allowed far too many government officials to get away with unconstitutional conduct.

The further tragedy of the ruling is that it does nothing to clarify the state of the law, let alone provide guidelines for what an inmate may or may not say in a published article. As one of McGowan's lawyers, Alexander Reinert, put it, the decision was silent about how "prisoners may express themselves to the outside world."

Reinert, a law professor at Cardozo, said he's disappointed in the ruling and is considering asking for a rehearing. Ryan Grim, HuffPost's Washington bureau chief, called the decision "appalling on its face."

McGowan wouldn't comment on the decision. Still, he has reason to be hopeful. Exactly one week ago, he completed his federal sentence -- nine years to the day after he was convicted. That means no more prison, halfway house or probation supervision for him.

Now free, McGowan is living in New York and working at a nonprofit that focuses on prison reform. He's also awaiting a decision any moment on the lawsuit he and other prisoners filed challenging the very things he wrote about in his offending HuffPost blog post.

If he wins there, maybe all will have been worth it.