For more than 40 years, Thomas Spota has been one of the most dominant figures in Suffolk County law enforcement. If he hadn’t decided to retire during a time of scandal and turmoil, his legacy would have been considerable.

Spota announced Friday he will not seek re-election in November, ending a record 16 years as the county’s top prosecutor. His decision to leave office after his term ends comes while the office is under federal investigation.

When he leaves office in January, Spota will have been ,rarely challenged politically since he won office in 2001. His tenure was marked by the unwavering support of police unions he represented during nearly 20 years in private practice.

As a homicide prosecutor in 1979, when he tried the killers of John Pius, a Smithtown boy who died when other teenagers crammed rocks down his throat, he met a young witness named James Burke, who would later become chief of department for Suffolk Police. Spota became his mentor over the years, putting him in charge of the detective investigators at the district attorney’s office. And it was Burke’s arrest on charges of civil rights violations and orchestrating a cover-up that turned attention to Spota’s role.

Federal investigators have focused on several cases, sources have said:

-- Burke’s beating of Christopher Loeb, an accused thief struggling with heroin, and his efforts to have the police department cover it up.

advertisement | advertise on newsday

-- The restoration of attorney Robert Macedonio’s law license after his cocaine possession conviction. Investigators believe Spota’s office ignored a variety of other crimes to protect wiretaps that were collecting political intelligence.

-- Spota’s abandonment of a grand jury investigating the shooting of a cabdriver in Huntington Station by a drunken, off-duty Nassau police officer.

-- The arrest of then-Suffolk Police Det. John Oliva for leaking information to Newsday.

-- Spota’s still secret deal with former Suffolk County Executive Steve Levy, which required Levy to not seek re-election and turn over his campaign funds to the district attorney’s office.

Spota’s colleagues said this is the end of an era.

“I think he came into office with a great deal of hope and support,” said defense attorney Bruce Barket of Garden City. “And he’s probably leaving with a great deal of disappointment, because of a number of incidents — not least, the indictment and conviction of his protégé, James Burke.”

Steven Wilutis, a former prosecutor and now a Miller Place defense attorney, said Spota was undermined by those close to him. “He was loyal, perhaps to his detriment,” Wilutis said.

“I’m not surprised he’s not running,” Wilutis said. “He’s had a rough couple of years. But he had a heck of a career as a prosecutor. He was a very, very good prosecutor in the courtroom.”

Spota, who lives in Mount Sinai, grew up in New Hyde Park. He joined the Suffolk district attorney’s office in 1971, five years after he graduated from St. John’s University law school.

He became chief of the office’s Major Offense Bureau, which then handled homicides.

advertisement | advertise on newsday

Spota left the office in 1982 and set up a private practice in Hauppauge. He served as counsel to county law enforcement groups including the Suffolk police detectives union. In that role, he often defended law enforcement officials accused of wrongdoing.

When the State Investigative Commission conducted hearings concerning brutality and corruption in Suffolk law enforcement in 1987, Spota defended those called before the commission. Former Suffolk County Court Judge Stuart Namm, whose accusations helped create the commission, saw Spota as the defender of a rotten establishment even then.

“Tom Spota — he’s their god,” Namm said in 2014, referring to police. “A horse doesn’t change colors.”

In 2001, the longtime Republican ran as a Democrat against District Attorney James Catterson Jr., who had lost the favor of police unions, and defeated him after a particularly contentious campaign.

Catterson tried to make an issue of Spota’s deep ties to police and police unions, saying he’d have a blind spot on police misconduct.

advertisement | advertise on newsday

Spota said then: “If there is a rogue police officer, I will be the first person to ensure that he is prosecuted. I don’t think any police officer or anybody who is helping me in my campaign expects anything else.”

After his election, he continued to say he would prosecute bad cops when he found them.

“So I don’t have a problem doing that,” he said in 2006. “My philosophy is if you commit the crime and I should prosecute you, I’m going to. I haven’t lost any friends I know of through prosecutions.”

Spota also made a point of focusing on political corruption, particularly early in his tenure.

He brought bribery cases against Fred Towle, a Republican county legislator from Shirley who was sentenced to 6 months in jail, and Steve Baranello, a Democratic campaign aide and the son of former Suffolk Democratic chairman Dominic Baranello. He received a community service sentence. He also prosecuted Islip Supervisor Pete McGowan.

His investigation into political fundraising by Levy, a Republican, resulted in Levy’s agreement in 2011 not to seek re-election and to turn over his $4.1 million war chest to Spota, who distributed it to Levy’s donors.

Neither Spota nor Levy has ever discussed the details of that still-secret deal. Spota never specified what Levy may have done wrong or why he wasn’t prosecuted.

In subsequent terms, Spota touted his creation of the county’s first vehicular crime unit to crack down on drunken drivers and hit-and-run accidents. After a pain pill user killed four people at a Medford pharmacy in 2011, he went after doctors who illegally prescribe opioid painkillers.

“Our whole thing is our record,” Spota said. “We’ve battled corruption, fraud, vehicle hit-and-runs and drugs.”

But even before Burke’s downfall, there were other criticisms of Spota’s record. Many remain uneasy about the secret deal that forced Levy from office, for example.

In 2009, a state appellate court barred Spota from prosecuting immigration attorney Felix Vinluan and 10 nurses who resigned on the same day in April 2006 from Avalon Gardens Rehabilitation & Health Care Center in Smithtown. Spota had charged them after meeting privately with officials from the center’s politically connected owner, SentosaCare.

Spota also drew heat for the aborted grand jury investigation into the 2011 shooting of cabdriver Thomas Moroughan by drunken, off-duty Nassau officers. The officers were not charged, even though a Nassau internal affairs report said they committed felonies, and Suffolk detectives accused of fabricating an incriminating statement from Moroughan were not investigated seriously, critics said.