Comedian Artie Lange, who appeared in state Superior Court in Newark for a probation violation on Friday, avoided jail time even though he tested positive for drugs.

Instead, Judge Nancy Sivilli directed Lange’s attorney to make an application to drug court. If Lange is not accepted into the program, he will again face a jail sentence.

Before Sivilli made her decision, she requested that Lange undergo a drug test and return to the courtroom.

Lange, who is serving four years of probation after pleading guilty to heroin possession, tested positive for cocaine, amphetamine, benzodiazepines and Suboxone. Lange’s lawyer, Frank Arleo, told the judge he had prescriptions for the benzos and amphetamine. Suboxone is used to treat opioid addiction.

Assistant Prosecutor Tony Gutierrez said Lange would have had to use cocaine within the last two days in order to test positive.

“I wouldn’t be arrogant enough to come in here after using cocaine for two days,” said Lange, 51, wearing a dark blue “New York” hoodie, his nose appearing deflated and misshapen from a long history of snorting cocaine and heroin. “It’s in my system and it shouldn’t be.”

“Heroin is out of my life," he said.

In October, Lange tested positive for drugs more than once — for both cocaine and opioids — which made jail time a real possibility for the comedian, who spent nearly a decade as a host on “The Howard Stern Show" and has a recurring role on the HBO series “Crashing.”

Earlier this month, the comedian returned from a short stint in rehab.

“He keeps doing Band-Aid-type remedies for himself,” Gutierrez said, referencing Lange’s latest rehab program, which covered 25 days. He said the approach is not appropriate for someone like Lange, who has dealt with addiction for decades.

Lange with his lawyer, Frank Arleo.

“Clearly something more is needed,” Arleo said, agreeing with the prosecutor. “Jail is not the answer, in my opinion.”

Lange, who lives in Hoboken, was sentenced to four years of probation this past June in connection with an arrest in May of 2017. Last December, Lange pleaded guilty to heroin possession after State Police reported finding him with 81 decks of heroin after they pulled him over on the Garden State Parkway near Bloomfield.

“Mr. Lange, the ball’s in your court now,” Sivilli told Lange at the time, warning him that if he violated the terms of his probation he would face up to five years in jail.

‘I’d love to say it’s willpower’

After his court appearance, Lange tweeted about testing positive for cocaine. But he seemed to mark the absence of heroin as a victory, saying he had gone 41 days without it. Lange said he had used cocaine 10 days ago but it remained in his body longer than he thought possible.

“The judge and Prosecutor were unbelievably compassionate,” Lange tweeted. “I’m not high. So I see it clearly now. They wanna save my life. 10 days ago when I left rehab I had to touch the flame. I used Cocaine...”

I have work to do. I feel now I can also stop Cocaine. But that’s arrogance and addiction. I’m accepting help. If I fail now I will go to jail. Jail is not for addicts. But I’d be giving them no choice. When I use illegal drugs I have to score them. That’s breaking the law- — Artie Lange (@artiequitter) December 14, 2018

“I am not stupid,” Lange continued, as part of a series of tweets. “I know I got help from ppl who came to court w me who did so cause of my celebrity.” He said he realized drug court would be his last chance to stay out of jail.

In November, after his relapse, Lange announced that he was checking into an inpatient rehab program. Just months before, the prosecutor argued that Lange should be ordered to attend a long-term inpatient rehab program, but Sivilli allowed Lange to attend an outpatient rehab program so he could work.

“I’m about to take a big step to help myself,” he tweeted before entering several weeks of rehab. “To save my life.”

Earlier this month, Lange returned from his a short stay at Retreat, an addiction treatment facility in Lancaster County, Pennsylvania. Toward the end of his time there, the comedian left twice to perform in New Brunswick and Cherry Hill, spending Thanksgiving at the facility. Thomas Garofola, the marketing officer for Retreat, sat alongside Lange as he waited for his court appearance in Newark, as did his sister, Stacey Lange.

Lange had surgery on his nose due to years of snorting cocaine and heroin — and one incident in which he accidentally snorted glass when trying to suck up smashed OxyContin tablets — which left him with no septum and a lot of ribbing from Twitter followers about his appearance. Answering speculation that he was abusing drugs again, Lange tweeted on Dec. 3 that he had been given a shot of Sublocade, a medication that blocks opioid receptors, meaning he wouldn’t be able to get high on opioids for a month.

“As an addict who loves bein high & not just feelin normal it’s a big deal,” he tweeted. “But the court allows it. I’m off dope cuz of it. I feel great. I’d love to say it’s willpower.”

On Tuesday, Lange announced that he would create a fund to assist addicts who need rehab but can’t pay for it, soliciting applicants for what he called the Survive the Party with Artie Fund. He said that starting in April, he would dedicate money from his shows to cover the cost of one month of rehab for those in need, about $30,000 per person.

“Starting this spring I will do 1 or 2 shows each month for as long as I live w all the money paying for one person’s rehab,” he tweeted.

Thx to the good ppl at Subxdoc for helping me stay clean. Just got a call from the great Judd Apatow. He says my stuff on the first episode of Crashing looks awesome. It premieres on HBO Jan 20. My 3rd season as a regular playin myself on HBO series. pic.twitter.com/MxS1N7EgCd — Artie Lange (@artiequitter) December 11, 2018

‘I think it’s a weakness’

In an interview with NJ Advance Media in July, Lange talked about his history with addiction.

“The dope makes me feel very weak as a person,” he said. “I don’t look at it as a disease. I think it’s a weakness.”

At the time, Lange said “fear of jail” was why his efforts with rehab would be different this year, following many previous attempts at staying clean.

Lange attributes his most recent stint in rehab to help from Kevin Meara, founder of City of Angels, a Hamilton-based nonprofit that assists people affected by addiction and their families. When Lange took a detour from Retreat to perform at a show in Cherry Hill, Meara was there, alongside staff from the rehab facility. Meara was also in court on Friday in Newark and spoke in support of the comedian, insisting that he had made progress, despite his setbacks.

Meara spoke to NJ Advance Media ahead of the Friday court appearance about the comedian’s efforts to stay clean, calling Lange “a very sick man" who has a long road ahead of him.

I got a shot of Sublicate. It’s an opiate blocker given w a needle. I can’t get high on opiates for a month. As an addict who loves bein high & not just feelin normal it’s a big deal. But the court allows it. I’m off dope cuz of it. I feel great. I’d love to say it’s willpower — Artie Lange (@artiequitter) December 4, 2018

Many of Lange’s fans who remember him from his “Stern” days have supported him in his efforts to recover. Others have written Lange off for so many attempts at staying clean.

Meara said those who rag on the comedian for relapsing are likely uninformed about the nature of addiction — that addicts can often become divorced from logic. He also criticized what Sivilli, the judge who sentenced Lange to probation, told the comedian in June: “You know, you’re getting too old for this.”

“Are you too old for cancer?" Meara said. “Is anyone too old for a heart attack?” Even senior citizens are not too old to get addicted to opioids, he said. “Words matter.”

Meara, who founded City of Angels in 2009 after his son died from a heroin overdose, said the idea Lange expressed about his addiction — that it is a weakness — can contribute to a feeling of worthlessness experienced by addicts.

“If you believe that your illness is a moral failing, that feeds into the disease,” he said.

“This disease is cunning. It’s the devil.”

Of course, Lange, like many comics, regularly deploys self-deprecation in his riffing and stand-up sets.

“I’m a f*** up in every way except my vocation,” Lange tweeted on Tuesday. “It’s the reason to stay clean! Then I think of my family, a new girl in my life, the view of Manhattan from my living room & U fans! So Why use?!”

This week, Lange, who grew up in Union Township, announced that he would start his “Live to Tell" tour in the next few months and film a new comedy special. He’s also slated to appear in the third season of “Crashing,” which premieres Jan. 20 on HBO. Last season, the show, starring Pete Holmes and produced by Judd Apatow — who have both spoken out in support of Lange — devoted an episode titled “Artie” to Lange’s character and his struggles with addiction, reflecting the comedian’s real-life experience.

Outside the cellar. Still clean. pic.twitter.com/s0orvaMNNY — Artie Lange (@artiequitter) December 4, 2018

‘Deep-seated demons’

The key to Lange’s recovery, Meara said, will be accepting that a healthier version of himself can exist. He pointed to the fact that mental health issues are often at the root of addiction.

“You’ve got two bags, one’s your drugs, one’s your demons,” he said. “When you’re in treatment, if you come home with your demons, there’s only one way you’re going, and that’s relapse."

The advocate said the death of Lange’s father still weighs heavily on the comedian.

“He’s got, obviously, some deep-seated demons," Meara said. Arthur Lange Sr., an antenna repairman, died in 1990, several years after falling off a roof and becoming a quadriplegic. The story of Lange’s father and his accident became part of the “Artie” episode of “Crashing." At the time, Lange’s family, beset by medical bills, had to go on welfare.

“That period of my life when my mother was struggling is something I can’t get out of my head,” Lange said in the July interview.

“It’s all about hope," Meara said. “That’s what we’re looking for for Artie, to be able to live the rest of his life with what he has to deal with.”

Sorry guys I’m too nervous about court in the AM to sleep. It should go fine I guess — Artie Lange (@artiequitter) December 14, 2018

Lange has publicly tangled with drug addiction since the mid-'90s, when he left his job as a cast member on “MADtv" after he was arrested for cocaine possession in Los Angeles. At the time, Quincy Jones, who served as a producer of the show, tried to support Lange in his recovery efforts. Many others, including Lange’s fellow comedians, would attempt to help him over the years.

In his latest memoir, “Wanna Bet? A Degenerate Gambler’s Guide to Living on the Edge,” Lange, a former longshoreman at Port Newark, says depression has followed him most of his life. In 2010, after Lange took a break from “Stern” to deal with his addiction issues, the comedian was hospitalized for a suicide attempt. His mother found him in his Hoboken apartment, where he had downed bleach, stabbed himself multiple times in the stomach and slit his wrists. It was his second suicide attempt. The first was after he joined the cast of “MADtv."

You can pal. Whether I can or not Right now I’m clean. I feel like I can take over the world. But I know that the world changes on a dime. So can we. Whether I fail or not pls know that u being a fan of mine means everything to me! And I love u — Artie Lange (@artiequitter) December 14, 2018

Stern eventually broke ties with his sidekick. Lange has said that the radio titan tried to help him. He blames the souring of their friendship on his addiction.

Despite Lange’s recent statement about his motivations to stay clean, he has often wavered between determined and resigned. In March 2017, after he was arrested on charges of cocaine and heroin possession near his Hoboken home — one of three arrests that year — Lange tweeted to fans, warning them against following his example:

“I wish I could tell u how my story ends."

Just hours before his court appearance on Friday, Lange tweeted that he was too nervous to sleep. He posted replies to fans, including one who said he was also coping with addiction.

“Right now I’m clean,” Lange said. “I feel like I can take over the world. But I know that the world changes on a dime. So can we."

Amy Kuperinsky may be reached at akuperinsky@njadvancemedia.com. Follow her on Twitter @AmyKup or on Facebook.