Already in his pajamas, Daniel Horgan didn’t expect to hear a knock on his door at 9 p.m. Even more surprising, his visitor swiftly tagged him with a lawsuit.

Yet another shocker was the plaintiff: Huntington Beach, where Horgan grew up and still resides.

“The Automatic Weapons Initiative is unconstitutional, invalid and not entitled to placement on the ballot,” the 25-page complaint reads.

“His initiative squarely hits the Second Amendment between the eyes and puts the city in opposition to state and federal law,” said City Attorney Michael Gates.

Horgan hastily wrote the gun-control initiative last fall, in the wake of the Las Vegas massacre. A few weeks later, he submitted his intent to circulate the petition with the City Clerk’s office.

“I basically wanted to ask the community, ‘Are you comfortable with the proliferation of AR-15s?’” Horgan said.

But then he sat on his idea for a while, unsure if he wanted to invest money in a cause that might never get off the ground.

Then came Feb. 14 – the day of the mass shooting at a high school in Parkland, Fla.

“I was so tired of feeling helpless and hopeless about this carnage,” said Horgan, 42, a mortgage lender. “I needed to focus on a solution.”

To “gauge interest,” Horgan paid a mailing company $1,300 to send out 2,000 copies of his petition to registered voters. It proposes a law requiring “all semi-automatic and automatic guns and rifles to be turned in to the City of Huntington Beach Police Department by Jan. 1, 2019.”

He would need about 12,000 signatures by June 2 for the measure to appear on the November ballot. From that initial batch, Horgan collected around 600.

Although he faced an uphill climb under a tight deadline, Horgan gave another 2,000 petitions a chance.

He came home from a vacation in mid-April “hoping to see a stuffed mailbox,” Horgan said. Instead, he found only 50 responses – a few featuring unfavorable messages such as “Eat Poo Snowflake.”

One person returned the initiative peppered with pellet holes. Scrawled across the top is the assurance, “This is in no way a threat.”

“Gee, why would I jump to that conclusion?” Horgan quipped.

That was probably it for the expensive mailings, he realized: “Miserable tally – the support just wasn’t there.”

Then on April 24, shortly after it was approved by the City Council in a closed session, Horgan was served with the lawsuit. He is scheduled to appear in Orange County Superior Court on May 24.

The claim states that the initiative “will unlawfully waste and expend taxpayer dollars to verify the signatures … causing City to suffer irreparable harm.”

The city decided against waiting for Horgan to submit signatures before taking action, Gates said: “We don’t leave anything to chance.”

Furthermore, Gates had noticed residents “expressing concern” about the petition on social media.

“The community was asking why the city was allowing this to happen,” he said.

While he did not comment on this specific case, Chapman University law professor John Eastman said state and city initiatives can be blocked from the ballot to avoid “the time and expense of putting a matter to a vote if it cannot legally have any effect.”

But some legal experts questioned the grounds for the lawsuit.

“What is most offensive to the Constitution is not the proposed initiative, but Huntington Beach seeking by litigation to deny the essence of democracy,” said Douglas Kmiec, a law professor at Pepperdine University.

The lawsuit, Kmiec added, ignores “one of the basic rights of citizenship – the First Amendment ‘right of the people to petition the government for a redress of grievances.’”

Erwin Chemerinsky, dean of UC Berkeley’s School of Law, called the lawsuit “bizarre.”

“I don’t see how Horgan did anything that creates a basis for his being sued,” Chemerinsky said. “No court has found a right to have assault weapons.”

Potentially, the lawsuit could cost Horgan tens of thousands of dollars. It asks the court to “grant city costs, including out-of-pocket expenses and attorneys’ fees.”

Gates said his office has devoted about 20 hours to the lawsuit so far.

Earlier this week, Horgan hired lawyer Jerold Friedman – who recently announced plans to run against Gates for city attorney in the November election.

“What kind of message does this lawsuit send to any citizen of Huntington Beach who wants to start a petition?” Friedman said. “It is extremely authoritarian. And, it’s a waste of city resources.”

Gates, however, said he saw no other option.

“I’ve heard comments that filing the lawsuit was not necessary,” he said. “But I took an oath to uphold and defend the Constitution, and I believed this was the best way to fulfill that obligation.”

Whatever the merits of the city’s lawsuit, Horgan said, he never imagined that his petition would lead him into battle against his hometown.

“I have no interest in doing something that would conflict with city law,” Horgan said. “My only intent was to speak my mind.”

CORRECTION 5/16/18: An earlier version of the story incorrectly stated in the headline which type of weapons proposed in the ban.