The US government has banned an electric shock machine that is used to zap children and young adults with special needs in a school outside Boston – the only institution in the world known to practice the controversial punishment “treatment”.

The US Food and Drug Administration (FDA) has taken the extremely rare move of imposing a total ban on the production and use of the electric shock machines, known as electrical stimulation devices. It said the ban – only the third such comprehensive prohibition of a medical device in FDA history – was necessary to “protect public health”.

The ban brings to an end a decades-long battle against the use of electric shocks at the Judge Rotenberg Educational Center (JRC) in Canton, Massachusetts. Disability groups and international human rights organisations have campaigned ceaselessly to outlaw the use of so-called “aversive therapy”, where pain is inflicted on vulnerable children in order to discourage them from self-harming or aggressive behavior.

More than 40 special needs residents of JRC, many with severe forms of autism, are understood to be on the electric shock regime. Managers of the center insisted the device was safe and pointed out that the use of shocks was approved in each case by the state family courts.

But over the years there have been a number of scandals at the school. In 2007 a boy was strapped to a gurney and given 77 electric shocks over a three hour period for bad behavior – only for it to be discovered that the order to inflict the pain had come from an outside phone call made by a prankster.

In 2010, the Guardian gained access to the school and reported on its controversial practices. During the visit it was revealed that one student had been living at the center for 22 years and was still being shocked on average 33 times a week.

A video recording also emerged in the course of a civil trial that showed a student, then aged 18, being zapped 31 times over seven hours. As he is shocked he is heard screaming: “That hurts, that hurts.”

Supporters of the school, including several parents, say its practice of “aversive therapy” has improved lives, and in some cases saved their children from self-induced injury or even death.

In 2013, the UN’s then monitor on torture released a report that found that the use of the device as a routine form of behavior control violated the UN convention against torture.

Announcing the ban, the FDA said that it had reached this rare step because it had concluded that the devices presented an “unreasonable and substantial risk of illness or injury”. A review of the evidence showed that residents who were routinely shocked faced a number of significant psychological and physical risks including depression, anxiety, PTSD, pain, burns and tissue damage.

The federal agency listed further possible risks including: “Suicidality, chronic stress, acute stress disorder, neuropathy, withdrawal, nightmares, flashbacks of panic and rage, hyper-vigilance, insensitivity to fatigue or pain, changes in sleep patterns, loss of interest, difficulty concentrating, and injuries from falling”.

Campaigners against the electric shock machines hailed the FDA’s ban as a huge advance.

Laurie Ahern, who has led opposition to the devices for more than a decade as president of Disability Rights International, said she was grateful that the FDA had prohibited “the electric shock machines that torture children and adults with disabilities at JRC. Finally, the residents there might find some freedom from horrific pain and fear and live the rest of their lives in peace.”

The ‘graduated electronic decelerators’ machines were invented by Matthew Israel, above, a psychologist with no medical training. Photograph: Rick Friedman/The Guardian

The FDA’s ban will come into effect 30 days after its final rule is registered. In special cases where individuals need a transition away from the shocks on to other forms of therapy a period of 180 days will be allowed.

JRC said in a statement that it will continue to advocate for use of electric shocks as “life-saving treatment”. It accused the FDA of reaching its decision “based on politics, not facts”, complaining that federal officials declined even to meet with parents of students on the regime.

It insisted “there is no evidence of physical or psychological side effects”.

An association of parents of residents of the center whose children routinely wear the devices and are zapped through pads attached to their arms or legs put out their own statement. “The FDA’s actions can only be interpreted one way – it is saying that our children’s lives do not matter.”

The machines are known internally within JRC as “graduated electronic decelerators” – GED. They were invented by Matthew Israel, a psychologist with no medical training.

During the 2010 tour of the school, the Guardian was told by Israel how he had come up with the idea of using pain to discourage harmful behavior when he read an utopian novel called Walden Two. The book depicted a fictitious community in which negative behavior was systemically thwarted.

Israel began experimenting with the practical application of “aversives” in 1971 starting with spanking with spoons and pinching. He then created his own electric shock machines.

Over the years, understanding has grown of how to treat severe autism and other conditions in which individuals can be extremely aggressive or harm themselves with head banging or eye gouging. The medical consensus is now that positive behavior support through rewards and teaching appropriate skills is both more effective and safer.

William Maisel, the FDA’s top official on evaluating medical devices, said: “Through advancements in medical science, there are now more treatment options available to reduce or stop self-injurious or aggressive behavior, thus avoiding the substantial risk” the electric shock devices present.