A judge is scheduled to consider Friday whether Hawaii can continue enforcing a new law banning firearms on its world-famous beaches, a measure that state leaders say makes them safer.

The state's latest gun control measure landed in court because of a lawsuit by three Maui residents who want to carry guns on beaches and other places deemed sensitive by the law, which took effect this month and involves a misdemeanor offense.

Lawyers for the plaintiffs, Jason and Alison Wolford and Atom Kasprzycki, say they especially want to protect themselves at isolated beaches where they might be fishing or going for a walk rather than sunbathing or swimming.

If U.S. District Judge Leslie Kobayashi grants the temporary restraining order they seek, the law would be blocked on an emergency basis as the lawsuit plays out.

In a court filing, the state said the law is crucial not only for public safety but for the economy. Hawaii's beaches "are the most popular recreational tourist activity" and a "central pillar" of a $19-billion tourism industry, the state said.

BODIES OF 2 HAWAII FREE DIVERS, FATHERS OF 6, RECOVERED OFFSHORE

Attorneys for the state also say beaches need to be gun-free because they host family and cultural gatherings.

The lawsuit alleges Hawaii, which has long had some of the strictest gun laws in the nation and the lowest rates of gun violence, is going too far with a wide-ranging ban on locations that also includes bank parking lots and restaurants serving alcohol.

In an indication of how vigorously Hawaii is defending the law, the state attorney general’s office has brought in Neal Katyal, a Washington, D.C., corporate attorney and former acting U.S. solicitor general, to serve as a "special deputy attorney general" on the case.

Handguns being sold

Handguns are displayed at a gun shop on June 23, 2022, in Honolulu, Hawaii.  (AP Photo/Marco Garcia, File)

Katyal and his firm "are defending the State of Hawaii pro bono — without any payment in attorneys’ fees — in this litigation," David Day, special assistant to Attorney General Anne Lopez, said via email. "We are grateful to Mr. Katyal and his team for their work on this important case."

Katyal has helped Hawaii on other cases, including a fight against former President Donald Trump's travel ban on citizens from several mostly Muslim countries.

Hawaii is still getting used to allowing residents to carry firearms in public after a U.S. Supreme Court ruling last year expanded gun rights nationwide, finding that people have a right to carry for self-defense.

2 HIKERS FOUND DEAD IN NEVADA'S VALLEY OF FIRE STATE PARK IN SCORCHING 114-DEGREE HEAT

The decision prompted the state to retool its laws, with Democratic Gov. Josh Green signing legislation in early June allowing more people to get concealed carry permits but banning guns in a wide range of places, including beaches, hospitals, stadiums, bars serving alcohol and movie theaters.

In the past, Hawaii’s county police chiefs made it virtually impossible to carry a gun by rarely issuing permits for either open carry or concealed carry.

The lawsuit argues that the new statute renders carry permits virtually useless.

Legal challenges to similar measures in other states are making their way through federal courts. In January, the high court ruled that New York can continue to enforce its ban on guns in many places, from schools to playgrounds to touristy Times Square.

Honolulu Prosecuting Attorney Steve Alm highlighted the issue of where people can carry guns when he announced the murder indictment earlier this week of Myron Takushi, who is accused of fatally shooting a man in a sports bar July 19.

CLICK TO GET THE FOX NEWS APP

"This case illustrates just how dangerous it can be to carry a weapon into a bar," Alm said. "It is much easier for a dispute to turn deadly when a gun is involved."

Takushi's attorney, Alan Komagome, declined to comment. Takushi is scheduled to be arraigned on Monday.

Takushi, who did not have a permit to carry, also was charged with a felony count involving a requirement that gun owners keep them in their homes or transport them only unloaded and in an enclosed container to limited locations such as target ranges and repair shops.