NEW YORK (Reuters) - A federal appeals court on Friday rejected a gun rights group’s constitutional challenge to strict New York City limits on how licensed handgun owners may use their weapons outside the home.

By a 3-0 vote, the 2nd U.S. Circuit Court of Appeals in Manhattan said the restrictions on people who have licenses to have guns at home, known as “premises” licenses, did not violate the Second Amendment.

Backed by the National Rifle Association, three gun owners and the New York State Rifle & Pistol Association had sought permission for holders of premises licenses to take guns to shooting ranges outside New York City, or other homes in New York state.

Though license holders could take unloaded guns to seven ranges within the city, the plaintiffs said the city’s restrictions amounted to a “near-complete ban” on gun transport.

Premises licenses are different from “carry” licenses, which give holders broader freedom to take guns outside the home.

Writing for the appeals court, Circuit Judge Gerard Lynch said the restrictions advanced the city’s “substantial, indeed compelling” interests in protecting public safety and preventing crime, by regulating firearms possession in public.

Lynch said that was enough to “easily justify the insignificant and indirect costs” imposed on gun owners’ rights, despite a 2008 U.S. Supreme Court decision that the Second Amendment protects an individual right to own guns.

The appeals court also rejected claims that the city impeded interstate commerce, and violated the plaintiffs’ right to travel and First Amendment right to “expressive association.”

Neither the Rifle & Pistol Association nor its lawyer immediately responded to requests for comment.

“We are pleased the court upheld this important rule,” said Nick Paolucci, a spokesman for the city’s law department. “Limiting public transport of handguns licensed for home possession makes us all safer.”

The decision was issued 1-1/2 years after oral arguments.

It upheld a February 2015 ruling by U.S. District Judge Robert Sweet in Manhattan.

Sweet wrote that there were at the time more than 40,000 active handgun licenses in the city.

The case is New York State Rifle & Pistol Association Inc et al v. City of New York et al, 2nd U.S. Circuit Court of Appeals, No. 15-638.