Gary Melius was shot in the head outside Oheka Castle, pictured, by someone wearing a mask. Zuma Press

A locally known Long Island developer and political fundraiser was shot in the head Monday outside Oheka Castle, the popular estate he owns and runs as a hotel and event space, police said.

Gary Melius, 69 years old, was shot while entering his vehicle in the castle's parking lot at around 12:30 p.m. by someone wearing a mask, said Suffolk County Police Department Det. Sgt. John O'Sullivan.

Mr. Melius was in stable condition. Zuma Press

No suspects have been identified, and "it doesn't appear to be an accidental shooting," Det. Sgt. O'Sullivan said. Mr. Melius was in surgery Monday evening and is in stable condition, he said.

"He is in good spirits. It was a miraculous situation and he will make a full recovery," said Ronald Rosenberg, Mr. Melius's attorney and close friend, who saw Mr. Melius before the operation.

Mr. Melius, who lives in the castle in Huntington, called himself an adept networker in a recent interview with The Wall Street Journal. He said he has 6,400 names in his address book.

"I collect people," he said.

Mr. Melius is known for his political contributions and the informal and formal parties he hosts at the estate. Former U.S. Rep. Anthony Weiner and his wife, Huma Abedin, married at Oheka Castle in a July 2010 ceremony officiated by former President Bill Clinton.

Mr. Melius has close ties to the Independence Party on Long Island. The party's Nassau County branch spent $118,000 on fundraisers at the castle over the last three years, according to campaign-finance records.

Mr. Melius donates to other political parties locally, statewide and nationally, and has contributed to Gov. Andrew Cuomo, former Secretary of State Hillary Clinton, Republican Rep. Peter King and the National Rifle Association.

"It's shocking everybody here," David Pennetta, a local official who has worked with Mr. Melius on real-estate projects, said of the shooting.

The French chateau-style Oheka Castle was built in the early 1900s and is listed on the National Register of Historical places. Mr. Melius said he first bought the castle in 1984, sold it, then bought it back. It was abandoned and in a state of disrepair before he led its restoration and conversion into a hotel and event space. Mr. Melius said he put in $40 million in renovationsinto the estate, painted with murals of the sky and including spiral staircases and a subterranean poker room.

"Certainly if you have a fundraiser there, people come," Mr. Pennetta said. "He's always helped out nonprofits, giving them pricing where they can afford to host events."

"He's been involved in the political growth of Long Island," he added. "He's touched a lot of people in a lot of different areas. He's always a fair guy."

In 2013, Mr. Melius was a central figure in a controversy that led to the resignation of Nassau County Police Department Commissioner Thomas Dale. Mr. Melius called Mr. Dale and asked him to arrest on perjury charges Randy White, a witness in a court case against Nassau County executive candidate Andrew Hardwick. Mr. Melius was supporting Mr. Hardwick's run.

Mr. White said during an official hearing that he was paid to collect signatures for Mr. Hardwick, resulting in the candidate being removed from the ballot.

A day after Mr. Melius called Mr. Dale, Mr. White was arrested on an outstanding warrant, Nassau County District Attorney Kathleen Rice has said. Mr. White was released after his arrest and given more time to pay the fine.

"Look, if I know these people, I'm not going to call the guy in the clerk's office," Mr. Melius told the Journal.

Mr. Melius said he dropped out of school at age 15 and worked in plumbing and construction before compiling a real-estate portfolio.In the early 1990s, he said, he was "dead broke." "I'm not the brightest guy, but I'm tenacious, so I just work," he said.

—Pervaiz Shallwani contributed to this article.