Susan* bought her 6-year-old son John an iPad when he was in first grade. “I thought, ‘Why not let him get a jump on things?’ ” she told me during a therapy session. John’s school had begun using the devices with younger and younger grades — and his technology teacher had raved about their educational benefits — so Susan wanted to do what was best for her sandy-haired boy who loved reading and playing baseball.

She started letting John play different educational games on his iPad. Eventually, he discovered Minecraft, which the technology teacher assured her was “just like electronic Lego.” Remembering how much fun she had as a child building and playing with the interlocking plastic blocks, Susan let her son Minecraft his afternoons away.

At first, Susan was quite pleased. John seemed engaged in creative play as he explored the cube-world of the game. She did notice that the game wasn’t quite like the Legos that she remembered — after all, she didn’t have to kill animals and find rare minerals to survive and get to the next level with her beloved old game. But John did seem to really like playing and the school even had a Minecraft club, so how bad could it be?

Still, Susan couldn’t deny she was seeing changes in John. He started getting more and more focused on his game and losing interest in baseball and reading while refusing to do his chores. Some mornings he would wake up and tell her that he could see the cube shapes in his dreams.

Although that concerned her, she thought her son might just be exhibiting an active imagination. As his behavior continued to deteriorate, she tried to take the game away but John threw temper tantrums. His outbursts were so severe that she gave in, still rationalizing to herself over and over again that “it’s educational.”

Then, one night, she realized that something was seriously wrong.

“I walked into his room to check on him. He was supposed to be sleeping — and I was just so frightened…”

We now know that those iPads, smartphones and Xboxes are a form of digital drug.

She found him sitting up in his bed staring wide-eyed, his bloodshot eyes looking into the distance as his glowing iPad lay next to him. He seemed to be in a trance. Beside herself with panic, Susan had to shake the boy repeatedly to snap him out of it. Distraught, she could not understand how her once-healthy and happy little boy had become so addicted to the game that he wound up in a catatonic stupor.

There’s a reason that the most tech-cautious parents are tech designers and engineers. Steve Jobs was a notoriously low-tech parent. Silicon Valley tech executives and engineers enroll their kids in no-tech Waldorf Schools. Google founders Sergey Brin and Larry Page went to no-tech Montessori Schools, as did Amazon creator Jeff Bezos and Wikipedia founder Jimmy Wales.

Many parents intuitively understand that ubiquitous glowing screens are having a negative effect on kids. We see the aggressive temper tantrums when the devices are taken away and the wandering attention spans when children are not perpetually stimulated by their hyper-arousing devices. Worse, we see children who become bored, apathetic, uninteresting and uninterested when not plugged in.

But it’s even worse than we think.

We now know that those iPads, smartphones and Xboxes are a form of digital drug. Recent brain imaging research is showing that they affect the brain’s frontal cortex — which controls executive functioning, including impulse control — in exactly the same way that cocaine does. Technology is so hyper-arousing that it raises dopamine levels — the feel-good neurotransmitter most involved in the addiction dynamic — as much as sex.

This addictive effect is why Dr. Peter Whybrow, director of neuroscience at UCLA, calls screens “electronic cocaine” and Chinese researchers call them “digital heroin.” In fact, Dr. Andrew Doan, the head of addiction research for the Pentagon and the US Navy — who has been researching video game addiction — calls video games and screen technologies “digital pharmakeia” (Greek for drug).

That’s right — your kid’s brain on Minecraft looks like a brain on drugs. No wonder we have a hard time peeling kids from their screens and find our little ones agitated when their screen time is interrupted. In addition, hundreds of clinical studies show that screens increase depression, anxiety and aggression and can even lead to psychotic-like features where the video gamer loses touch with reality.

In my clinical work with over 1,000 teens over the past 15 years, I have found the old axiom of “An ounce of prevention is worth a pound of cure” to be especially true when it comes to tech addiction. Once a kid has crossed the line into true tech addiction, treatment can be very difficult. Indeed, I have found it easier to treat heroin and crystal meth addicts than lost-in-the-matrix video gamers or Facebook-dependent social media addicts.

That’s right — your kid’s brain on Minecraft looks like a brain on drugs.

According to a 2013 Policy Statement by the American Academy of Pediatrics, 8- to 10 year-olds spend 8 hours a day with various digital media while teenagers spend 11 hours in front of screens. One in three kids are using tablets or smartphones before they can talk. Meanwhile, the handbook of “Internet Addiction” by Dr. Kimberly Young states that 18 percent of college-age internet users in the US suffer from tech addiction.

Once a person crosses over the line into full-blown addiction — drug, digital or otherwise — they need to detox before any other kind of therapy can have any chance of being effective. With tech, that means a full digital detox — no computers, no smartphones, no tablets. The extreme digital detox even eliminates television. The prescribed amount of time is four to six weeks; that’s the amount of time that is usually required for a hyper-aroused nervous system to reset itself. But that’s no easy task in our current tech-filled society where screens are ubiquitous. A person can live without drugs or alcohol; with tech addiction, digital temptations are everywhere.

So how do we keep our children from crossing this line? It’s not easy.

The key is to prevent your 4-, 5- or 8-year-old from getting hooked on screens to begin with. That means Lego instead of Minecraft; books instead of iPads; nature and sports instead of TV. If you have to, demand that your child’s school not give them a tablet or Chromebook until they are at least 10 years old (others recommend 12).

Have honest discussions with your child about why you are limiting their screen access. Eat dinner with your children without any electronic devices at the table — just as Steve Jobs used to have tech-free dinners with his kids. Don’t fall victim to “Distracted Parent Syndrome” — as we know from Social Learning Theory, “Monkey see, monkey do.”

When I speak to my 9-year-old twin boys, I have honest conversations with them about why we don’t want them having tablets or playing video games. I explain to them that some kids like playing with their devices so much, they have a hard time stopping or controlling how much they play. I’ve helped them to understand that if they get caught up with screens and Minecraft like some of their friends have, other parts of their lives may suffer: They may not want to play baseball as much; not read books as often; be less interested in science and nature projects; become more disconnected from their real-world friends. Amazingly, they don’t need much convincing as they’ve seen first-hand the changes that some of their little friends have undergone as a result of their excessive screen time.

Developmental psychologists understand that children’s healthy development involves social interaction, creative imaginative play and an engagement with the real, natural world. Unfortunately, the immersive and addictive world of screens dampens and stunts those developmental processes.

We also know that kids are more prone to addictive escape if they feel alone, alienated, purposeless and bored. Thus the solution is often to help kids to connect to meaningful real-life experiences and flesh-and-blood relationships. The engaged child tethered to creative activities and connected to his or her family is less likely to escape into the digital fantasy world. Yet even if a child has the best and most loving support, he or she could fall into the Matrix once they engage with hypnotic screens and experience their addicting effect. After all, about one in 10 people are predisposed towards addictive tendencies.

In the end, my client Susan removed John’s tablet, but recovery was an uphill battle with many bumps and setbacks along the way.

Four years later, after much support and reinforcement, John is doing much better today. He has learned to use a desktop computer in a healthier way, and has gotten some sense of balance back in his life: He’s playing on a baseball team and has several close friends in his middle school. But his mother is still vigilant and remains a positive and proactive force with his tech usage because, as with any addiction, relapse can sneak up in moments of weakness. Making sure that he has healthy outlets, no computer in his bedroom and a nightly tech-free dinner at the dinner table are all part of the solution.

*Patients’ names have been changed.

Dr. Nicholas Kardaras is executive director of The Dunes East Hampton, one of the country’s top rehabs and a former clinical professor at Stony Brook Medicine. His book “Glow Kids: How Screen Addiction Is Hijacking Our Kids — and How to Break the Trance” (St. Martin’s) is out now.