The entrance to the Judge Rotenberg Centre, in a suburb of Boston, is a riot of bright colours and surreal designs. The receptionist greets visitors from a deep purple chair in front of yellow and pink neon panels. Corridors are lit by elaborate chandeliers and lined with 6ft models of Bugs Bunny and Daffy Duck. There is a meeting space, called the Whimsy Room, that has a purple shag-pile carpet, and pink, mauve and lime-green walls hung with carnival masks.

But the decor is far from the most unusual aspect of this establishment. It is the only school in the US, perhaps the world, that uses pain as a treatment for children and adults with severe autism or emotional problems.

Residents at the school carry small rucksacks, trailing wires that lead under their clothes and end in electrodes attached to their skin. Each rucksack contains a box, operated by staff members via remote control. When a button on the controller is pressed, a signal is sent generating a charge that delivers an electric shock to the skin. The teachers regularly inflict electric shocks on students, some as young as eight, zapping them for up to two seconds on their legs, arms or stomach.

Ever since it was founded, 40 years ago, the school has been the subject of fierce controversy. Critics say the use of pain on society's most vulnerable members is a disgrace that should not be tolerated in any country. But 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.

The school's founder, Matthew Israel, is every bit as unconventional as the environment he has created. A short, quietly-spoken man with a mop of tightly-curled hair, he first came across the study of punishment and reward as an undergraduate psychology student at Harvard in the 1950s. He signed up for a course by the famous behaviourist BF Skinner, who taught his pupils that, just as pigeons or rats could be trained to change their habits in laboratory experiments, so could human beings.

Skinner had written a novel called Walden Two, in which he envisaged a fictitious community of 1,000 people engineered to produce the happiest and most efficient society. Every activity in the community is shared, from child rearing to cooking and manual labour. Positive emotions are rewarded and negative ones discouraged; meanwhile, children are given rigorous ethical training to turn them into model citizens.

Israel read the novel and was hooked. "Skinner believed you could use intelligent planning to make people healthy, happy and creative. He argued that it should be possible to develop a scientific approach to behaviour. That was very captivating to me."

After completing a doctorate in psychology at Harvard, Israel decided to make Skinner's imagined world a reality. He set up his own behaviouralist communes in the 1960s, along the lines of Walden Two. "They didn't work well," he says. "People had different ideas."

But the failed experiments got him thinking about children. There was a three-year-old girl at one of his communes who was spoiled and demanding. He found that, with the application of what Israel calls "mild punishments", she could be transformed into a charming child.

It was here that Israel parted company with Skinner, who explicitly states in Walden Two that punishment is not allowed. But once Israel had discovered what he believed to be its transformative potential, there was no holding him back. He devised a new regime for children with special needs, including those on the autistic spectrum. By mixing positive rewards for good behaviour with punishment for bad, he believed he could steer children away from self-harming or aggressive habits.

He started a school in 1971, initially in Rhode Island and then outside Boston. In the early years, he used improvised punishments: spanking with spatulas, pinching (he calls it "muscle squeezing") and dousing kids with a water spray. In the late 1980s, he adopted a more structured approach, deploying a shock machine that had been built by the parents of an autistic girl. The problem was, the charge generated by the machine was judged too weak to change the children's behaviour. On a single day, one of the children in Israel's school, Brandon, then 12, was given no fewer than 5,000 shocks, without success.

So Israel decided to develop his own, more powerful, pain machine. He invented the GED, or Graduated Electronic Decelerator. It is a basic electricity generator that puts out a 15 to 30 milliamp shock, lasting for two seconds. Later, Israel decided that an even more powerful machine was called for to treat the severest of cases, and designed the GED-4, which has three times the electrical charge of the basic GED.

These devices are not to be confused with ECT, or electroconvulsive therapy, where electricity is pulsed through the brain, often as a treatment for depression. Israel's shocks are applied to the skin as a means of discouraging bad behaviour, rather than changing a person's mental state.

Students are given shocks when they behave badly – they may be disruptive in class, say, or threaten staff. However, Israel insists, most of them make the connection between problem behaviour and pain fairly quickly, and stop acting up within weeks. He does concede that some on the autistic spectrum may need to keep the GED long term. For them, he says, the machine is just like wearing "glasses or hearing aids".

Israel is fully aware of the controversial nature of what he does. He is, he says, at the centre of a "political firestorm". "Any humane person wants to avoid punishment," he says. "Most professionals don't want to touch it, even though they know it's a very effective treatment."

But he insists the shocks feel no worse than a two-second bee sting. And that the alternatives are far worse. Students can be so dangerous to themselves or others they can threaten lives, he says, and more conventional care centres are often ill-equipped to deal with them. They end up either expelled, or heavily doped with psychotropic drugs.

Students are given shocks when they behave badly. Matthew Israel says most of them make the connection between problem behaviour and pain fairly quickly. Photograph: Rick Friedman

By contrast, Israel takes pride in turning nobody away, however severe their condition. "Some of our students have been expelled from 20 or more programmes, and we take all of our students off the drugs they are on when they come here. Compare that with skin shocks that have no side effects and no long-term damage," he says.

Israel shows me a video featuring some of the most severely autistic students before and after they are given electric shocks. It is deeply disturbing. Here is Janine screaming and banging her head on the wall. Israel's voice tells us she used to slap herself and pull out her own hair, 24 hours a day. "Once the GED was introduced into Janine's programme, she became much calmer and happier." The next sequence shows Janine going out to lunch with staff, her self-abusive habits seemingly under control and her hair grown back.

Here is Brandon, the boy who was shocked 5,000 times in one day. Israel tells us he used to vomit up his food, starving himself to 52lb (24kg). Over footage of Brandon vomiting and spitting, he says, "We found there was no medical solution to his problems. The only thing that saved his life was a remote control skin shock device."

When the video ends, Israel sits back in his chair and says, "Most people aren't aware of the severity of the problems some individuals have. We have a student who has pulled out 11 of his adult teeth by himself. A young woman hit her head so hard with her knee she detached her retinas. There's a boy who pushed his hands way down his throat and ripped up parts of his oesophagus. Once you've seen that sort of self-abuse, why wouldn't you want to try a treatment, even though it's controversial?"

He then takes me to the Yellow Brick Road, the positive reward area of the school where children who have fulfilled their contract with their carers are treated to the land of Oz. There are full-sized models of the Tin Man, Scarecrow and the Lion, a Crystal Forest of trees with cut-glass leaves, and an animatronic Good Witch Of The West into which students can insert a reward token and trigger a recorded message: "Hello. Have you been a good witch or a bad witch? You must be good, because you are about to receive a wonderful reward in the Reward Store."

The store looks like a chintzy shopping mall. Here students can exchange tokens for CDs, clothes, cosmetics, jewellery, toys and trinkets. Alternatively, they can spend their rewards in an arcade with a pool table and video games, which is where we find Mike playing computer baseball. He is carrying the GED on his back and has electrodes on his waist. Israel tells me that Mike, 20, is on the autistic spectrum and has been at the school for two years. When he arrived, he would refuse to get out of bed and would lash out at staff. "He was kept separate from other students because he was dangerous. Now he's blossoming. This is his first year off medications since he was six."

I ask Mike, in Israel's presence, what it feels like to be zapped with the GED.

"Electric shock."

Does it hurt? He nods.

How has it changed his life?

"Better."

Is he scared of it?

"A little bit."

We return to Israel's office and he ushers in Louisa Goldberg. She is the mother of Andrew, 30, who was born brain damaged from oxygen deprivation and is, she says, an "adult-sized toddler".

At nine, Andrew was put in a residential care home because his parents were worn out by caring for him around the clock. "Our younger son was being beaten up regularly. We were all getting our hair pulled and being bitten. We couldn't keep him safe."

Andrew stayed for several years at the home, but as a teenager grew more and more aggressive. He was put on psychotropic drugs to calm him down. He began sleeping through day and night. "He would sit and drool. He was a zombie, basically. It was just no life for him."

Eventually, Goldberg says, the care home told her it could no longer look after Andrew. They left him in the parking lot of a local hospital. Which is how she came to bring him to Israel's school.

Andrew was put on the GED, starting with an average of 17 shocks a day. He has been at the school for 11 years, and still wears the device. How does she come to accept the infliction of pain on her own son?

"We realise it doesn't sound so nice," she says. "People refer to it as torture, but as a parent the real torture for us was seeing Andrew going nowhere. Sitting there like a zombie on medication. It's given our child back his life."

Last June, the human rights group Disability Rights International released a coruscating report that sought to debunk Israel's case for "aversive treatment". The use of electric shocks was not a treatment at all, it said, but torture.

On the back of the report, the then UN special rapporteur on torture, Manfred Nowak, was asked by ABC television for his assessment of the regime. Did it amount to torture? "Yes. I have no doubts about it," Nowak replied. "It is inflicted in a situation where a victim is powerless. And, I mean, a child being subjected to electric shocks, how much more powerless can you be?" The US Justice department is currently investigating the centre under disability discrimination laws.

Put at its most simple, the argument made against the school by its opponents is that it uses public money to cause pain to vulnerable children. The money is by no means insignificant. There are 225 students at the centre, drawn from seven states across America, with state or federal agencies paying about $220,000 a year per child. That gives Israel an annual turnover of almost $50m, which he uses to pay the 900 staff and keep the premises in their sparkling condition, as well as spending huge sums on lobbying. Last year, he paid Rudy Giuliani's law firm $100,000 to lobby against a bill in Congress that might have outlawed the use of electric shocks.

Two-thirds of the school's students are under 21, and 97 of them wear the GED backpacks. This figure might be higher were it not for a court case in the 1980s – the result of one of the most serious attempts by opponents to have the school closed down. Ultimately, a Massachusetts judge, Ernest Rotenberg, ruled it could stay open, with the proviso that not only parents but also the courts would have to approve every child before he or she was subjected to electric shocks. Israel renamed the school the Judge Rotenberg Centre in his honour.

Of those 97 students, some are emotionally disturbed – they may be from difficult backgrounds, have attention deficit disorder, or just be unruly; many are children who could quite easily be cared for, critics say, with the use of more conventional, positive therapies. Others have developmental issues – they may, like Andrew Goldberg, have had problems at birth or be at the severe end of the autistic spectrum.

Brandon is the most extreme case. Though he's been living at the school since 1989, he's still shocked on average 33 times a week. There are five other students at the school who, according to the Massachusetts authorities, are shocked on average more than 10 times each a week, and all of them have been in the centre for at least eight years. Janine, 40, has been a resident for more than 25 years and still wears the GED 24 hours a day.

A recent inspection by the Massachusetts Department of Developmental Services questioned this long-term use of electric shocks, and objected to their application for minor infringements such as spilling drinks, refusing orders and picking food up from the floor. Rather pointedly, its report concluded: "Staff need to keep the floor clean."

Even more controversially, Israel still practises a treatment he calls Behaviour Rehearsal Lessons, or BRLs. He created this technique for students considered to have a behavioural problem so potentially dangerous it had to be prevented in advance. Israel uses the example of someone who has the habit of jumping out of fast-moving cars. "You don't even want him to do it once," he says.

The student is placed in a chair, often restrained with straps. Then, for up to 10 minutes at a time, they are ordered to carry out precisely the behaviour they have been told not to do. If, say, they have the habit of slapping themselves on the head, they are ordered to do so. If they try to get away, they are zapped with the stronger GED-4 shock machine. But if they follow orders, and slap themselves, they are zapped even more frequently. The process is repeated until they sit motionless in the chair for a full 10 minutes.

Hilary Cook, now 22, who spent three years at the school until 2009, remembers vividly being put on BRLs. "They would rush in unannounced and prompt me to do behaviours that were inappropriate, then shock me for doing them. That put me in a constant state of fear, because it could happen at any moment."

The system is open to abuse. The school has 29 residential properties in which students sleep at night and, in August 2007, a call came in to one of them to report that two students had misbehaved earlier in the evening and needed to be shocked. It was 2am, but the staff located the two students, aged 16 and 19, and began zapping them in their sleep. The boys awoke and protested that they had done nothing wrong, but the shocks continued. Over a three-hour period, one boy was shocked 77 times, the other 29. It later transpired that the initial call had been a hoax.

Such incidents have, of course, generated much negative publicity. But for Laurie Ahern of Disability Rights International, the core objection to the school is simple. "It's horrible that children and adults with disabilities are still, in 2011, being tortured through the use of electricity. We wouldn't tolerate that in Guantánamo or Abu Ghraib. We don't do it in domestic prisons any more. If your neighbour used a Taser on their children to get them to behave, you'd have them arrested. They'd be picked up even if they did it to their dog."

Carol Povey, of the UK's National Autistic Society, agrees: "Those purporting to help people using electric shocks demonstrate an appalling disregard for the individual's human rights. It is essential to properly understand and manage challenging behaviour, rather than attempting to simply control or prevent it through force. The right support at the right time can make an enormous difference."

Israel refused to let me experience the electric shocks first hand, saying there had been too many "sensationalist" accounts. Instead, Hilary Cook describes them for me: "They tell parents it feels like a bee sting, but what it really feels like is intense pain that lasts for several seconds. I was afraid, waiting for the shocks to come."

Since leaving the school in 2009, she has been on a positive therapeutic programme that has taught her to cope with severe emotional problems. "Electric shocks only work as long as you are receiving them. They don't teach you how to change your life."

One parent, who asked to remain anonymous, has a 26-year-old son who was at the school for seven years until he left last year. She says she liked the look of the school and its non-medication policy, but wasn't aware of its "dark side".

"They said it was like a bee sting, but I've seen my son being given shocks so powerful his limbs shook. He was being shocked up to 20 times a day. It was cruel. It was inhumane. I pray to God to forgive me for putting my son through that."