There is a specter haunting the Hamptons — one that’s turning some of the priciest properties in the country into fortresses equipped with bulletproof glass, weaponry and panic rooms.

“I sleep with a gun underneath my pillow: a Walther PPK/S, the same one James Bond carried,” said John Catsimatidis, owner of Red Apple Group and Gristedes Foods, who has a vacation property in East Quogue. “[My wife] Margo prefers a shotgun. Although, once, she thought she heard something, got the shotgun out and shot through the door.”

The billionaire and his family, like others in the Hamptons, are shaken up over concerns that the vicious Salvadorian gang MS-13 is too close for comfort. In April, members of the gang massacred four young men behind a soccer field in Central Islip. Three months later, a Hampton Bays brothel raided by police was found to be tagged with an MS-13 sign. And in 2016, a man with MS-13 connections broke into a Southampton home and sexually assaulted a woman.

Last year, Southampton Town Police Chief Steven Skrynecki publicly expressed concern that the gang might spread further east. When he deployed police equipped with antiterrorism gear, including automatic weapons, along the perimeters of summer 2017 charity galas, locals took note.

One Southampton homeowner, who requested to remain anonymous for security reasons, recently outfitted her East End manse with bulletproof glass and hidden cameras throughout.

“[MS-13 is] in Suffolk County,” she said. “What’s an hour car ride? They are near.”

She’s not alone in her concern. “The home-security business is very event- and news-driven,” said Gary Blum, president of Armored Entry, a company that installs bullet-proof, super-secure windows and doors. “We get business when there is a tremendous amount of fear being generated.”

Blum’s products aren’t cheap, starting at $6,000 for a single window “that you can beat with a sledgehammer without making a dent.”

But the high price might actually be a selling point.

“The big thing [with homeowners] in the Hamptons is that if somebody has it, they [all] want it,” said Chris Cosban, a Long Island contractor who installs panic rooms in the area’s mansions. His company, Covert Interiors, charges between $25,000 and $200,000 for a standard space. (High-tech add-ons, such as fingerprint recognition, cost extra.) “There is a wow factor,” he said. “They like to brag about it.”

Herman Weisberg, managing director of the personal-security firm Sage Intelligence Group, said many of his clients look at their panic rooms like amenity spaces — doubling as home theaters, wine cellars or even gun vaults where weapons can be safely displayed.

“People used to open up their garages and show off their Lamborghinis,” Weisberg said. “Now they take guests to the wine bar in their safe room.”

Catsimatidis, who, in addition to worrying about MS-13 has also had his home broken into, is installing infrared sensors at his place. But that’s nothing compared to the security measures that Al Corbi, president of SAFE (Strategically Armored & Fortified Environments), an architecture-focused security firm, has designed for customers, including Hamptonites.

“I finished a system for $100 million,” he said of one West Coast project. “That sounds like a lot but there is nothing I know of, human or manmade, that could possibly harm this family for three generations, including global nuclear holocaust, a pandemic or a second Ice Age.” Plus, he added, “It’s like a Ritz-Carlton underground.”

Still, some East Enders feel their neighbors are going overboard.

“In the Hamptons, it’s hard to know if someone is an oligarch and lots of security makes sense, or if somebody is just paranoid,” said an East Hampton resident of means, who asked to remain anonymous.

He pointed to people such as billionaire investor Ira Rennert, who reportedly keeps a Hummer packed with guards at the edge of his 63-acre Sagaponack estate, which includes a 110,000-square-foot, 29-bedroom mansion.

“The neighbors do not love a Hummer sitting on Peters Pond beach,” the source said. “I don’t know why he needs that. But billionaires [like] security and there are a lot billionaires in the Hamptons. I think they get more paranoid the richer they become.”