NEW YORK — When Sylvester Zottola was assassinated in October outside a McDonald’s in the Bronx after a string of near misses, it was widely believed his death had something to do with his long association with the Bonanno crime family.

But the mastermind of the killing, federal prosecutors now say, was actually a member of a family even closer to Zottola — his own son.

Anthony Zottola, 41, of Larchmont, New York, hired a member of the Bloods gang, Bushawn Shelton, 35, to kill his father and his older brother, Salvatore, prosecutors said.

Shelton in turn outsourced the job to several other members of the Bloods, according to a new indictment in the case unsealed Tuesday in the Eastern District of New York.

Sylvester Zottola, 71, who was in charge of the installation of video poker machines at mob gambling hubs throughout the 1990s and early 2000s, was waiting in the drive-thru window at a McDonald’s on Oct. 4 when a gunman shot and killed him.

He and his elder son, Salvatore, had each recently survived violent attacks. It was revealed Tuesday those attacks were the failed early attempts by the newly charged group and its mastermind, the younger son. Ten men have been charged to date in the murder.

The plot was plagued for more than a year by false starts and missteps, prosecutors said in court papers filed Tuesday.

Would-be assassins arrived to kill their targets, only to spot the police in the area and change their minds, the documents said. Once, a man stopped Sylvester Zottola near his home but ran away after only punching him in the face.

The ringleaders, Anthony Zottola and Shelton, rehashed each attempted hit and planned new strategies in text messages, using a thinly veiled code meant to sound as if they were discussing shooting a film.

For example, on Nov. 26, 2017, Sylvester Zottola was driving when a dark-colored van cut him off and made him stop, prosecutors said. A man in a mask pointed a gun at him, but he was able to flee.

Forty-five minutes later, Anthony Zottola asked Shelton in a text: “How you looking with the filming.” He added: “I hope you can get the actor to work.”

“The star stormed off set,” Shelton replied.

Weeks later, on Christmas Day, Anthony Zottola texted, “I saw the actor today,” referring to his father, prosecutors said. “He looks ready to finish the scene. Hopefully everyone is ready tomorrow to wrap it up.”

Two days later, Sylvester Zottola was attacked in his home and beaten and stabbed in the neck. Again, he survived.

The following summer, on July 11, a gunman ambushed the elder Zottola son, Salvatore, outside his home, shooting him several times. In a now-familiar outcome, he survived. Shortly after, his little brother and Shelton were rehashing that failure.

“Dealing with a headache from this morning,” Anthony Zottola said.

“Yeah I also had a migraine from this morning,” Shelton replied.

The defendants planted tracking devices on the cars of their targets, prosecutors said. On Oct. 4, they finally succeeded at the McDonald’s, prosecutors said. Days later, Shelton was arrested and accused of participating in a murder-for-hire plot, but its author remained a mystery — until Tuesday.

“Zottola’s persistence over the course of months after multiple failed attempts on the lives of his close family members speaks to his commitment” and a mission to “devastate his family,” the office of the U.S. attorney in Brooklyn, Richard P. Donoghue, wrote in a detention memo.

On Monday, officers executed search warrants and arrested four defendants, including Anthony Zottola. Officers found more than $130,000 in cash in his home, prosecutors said.

Anthony Zottola, a father of three who manages and owns numerous apartment buildings, pleaded not guilty to a murder-for-hire charge in U.S. District Court in Brooklyn on Tuesday afternoon. Magistrate Judge Roanne L. Mann singled out the text messages in denying his request for bail.

“The evidence of his involvement in the murder of his father and the attempted murder of his brother is overwhelming,” she said.

She added, “He wasn’t the one who fired the weapon, but he was the one that called the shots.”

In another turn in the family drama, Anthony Zottola’s older brother, Salvatore, whom he allegedly tried to kill, broke down weeping in the audience as the magistrate judge denied his brother bail. He left court with his brother’s wife, who also had collapsed in tears.

More than a year before his father was murdered and his own arrest, Anthony Zottola unwittingly predicted the outcome of the plot in one of the filming-a-movie text messages.

“I can see the film,” he wrote, “taking a twist.”

This article originally appeared in The New York Times.