By Basil Katz

NEW YORK (Reuters) - A federal judge made permanent on Wednesday her order blocking enforcement of a U.S. law's provision that authorizes military detention for people deemed to have "substantially supported" al Qaeda, the Taliban or "associated forces."

U.S. District Judge Katherine Forrest in Manhattan had ruled in May in favor of non-profit groups and reporters whose work relates to conflicts in the Middle East and who said they feared being detained under a section of the law, signed by President Barack Obama in December.

Wednesday's 112-page opinion turns the temporary injunction of May into a permanent injunction. The United States appealed on August 6.

The permanent injunction prevents the U.S. government from enforcing a portion of Section 1021 of the National Defense Authorization Act's "Homeland Battlefield" provisions.

The opinion stems from a January lawsuit filed by former New York Times war correspondent and Pulitzer Prize winner Chris Hedges and others. The plaintiffs said they had no assurance that their writing and advocacy activities would not fall under the scope of the provision.

Government attorneys argued that the executive branch is entitled to latitude when it comes to cases of national security and that the law is neither too broad nor overly vague.

"This court does not disagree with the principle that the president has primacy in foreign affairs," the judge said, but that she was not convinced by government arguments.

"The government has not stated that such conduct - which, by analogy, covers any writing, journalistic and associational activities that involve al Qaeda, the Taliban or whomever is deemed "associated forces" - does not fall within § 1021(b)(2)."

A spokeswoman for the Manhattan U.S. Attorney's office, which represents the government in this case, declined to comment on the ruling.

The case is Hedges et al v. Obama et al, U.S. District Court for the Southern District of New York, No. 12-cv-331.

(Reporting By Basil Katz, editing by Philip Barbara)