A US federal judge has barred the state of New York, at least for now, from enforcing the part of a closely watched gun law that bans firearms from churches or other places of worship.

The ruling marks the latest victory for gun owners in a tug-of-war with the state of New York over its strict new statute, which as of 1 September makes obtaining a license more difficult and prohibits firearms in a long list of "sensitive" public and private places.

Places of worship are among those places where guns were forbidden.

Two church leaders sued last week, saying that such a constraint ran counter to the gun rights spelled out in the Second Amendment of the US Constitution.

US District Judge John Sinatra agreed in a 40-page written ruling, issuing a temporary restraining order against the state of New York from carrying out the law while the court fight proceeds.

Judge Sinatra cited a landmark US Supreme Court decision in June that struck down New York's previous law, which barred individuals from carrying a handgun in public without proof of special circumstances.

The top court found that the statute, enacted in 1913, violated the Second Amendment.

New York legislators quickly passed new rules on gun ownership which Judge Sinatra, in his ruling, called "even more restrictive" than the law struck down by the Supreme Court.

"The nation's history does not countenance such an incursion into the right to keep and bear arms across all places of worship across the state," the judge wrote. "The right to self-defence is no less important and no less recognised at these places."

The judge added that, based on the Supreme Court's ruling earlier this year, the plaintiffs were likely to succeed on the merits of their lawsuit.

A spokeswoman for the New York Attorney General said the office was reviewing the decision and "considering our options in our ongoing efforts to protect New Yorkers and defend our common sense gun laws."