How can you get high without breaking the law? A survey of friends and colleagues. "Smoke nutmeg," said an actor. "Find a dodgy Starbucks barista who'll sell you the nitrous oxide cans they use to whip cream," said a banker. "Ask around for something called Methedrome, or Mephedrone, or Mephedrome," advised an account manager. "Lick a newt," texted a doctor, "and don't ask me things like this again." One PR directed me towards news stories about Spice, an over-the-counter smoking mixture that was reported to have effects similar to cannabis; a web developer directed me to a recent issue of Mixmag, announcing the new popularity of "analogue drugs" such as Mephedrone (aha!) in British clubs. Something known as "that purple drank" was a favourite of American rappers in the 1990s, an A&R man told me: "I think it was a mixture of cough syrup and Sprite and it made everything move very slowly." A teacher remembered that a fistful of ProPlus worked when he was younger. A civil servant had tried snorting Dreft detergent, to no effect.

I was sifting through this jumble of urban myth and murky fact when a report was forwarded to me by a medical student. Published last month by drugs information charity DrugScope, the report stated that "legal highs" had, for the first time, made a significant impression in its annual survey of drug use. Legal highs? That sounded right. I wanted to try some. "Go to a head shop," said the student. "You'd be surprised."

Head shops – purveyors of drug paraphernalia and herbal remedy, invariably dwelling on the edge of an urban centre, with lava lamp and glass bongs on display in the window – have never enjoyed a cast-iron reputation. I'd always assumed they were a bit of a racket: silly but harmless, selling ineffectual energy capsules to festival-goers, or things like privet branches and tumbleweed to credulous new agers. When I crept cautiously into a head shop in Edinburgh and saw that there really was a ball of tumbleweed for sale, I prepared myself for the worst – to be offered a handful of magic beans in exchange for my watch, perhaps, or sold the instructions to a dangerous curse. It may be an industry worth £10m a year, according to a 2006 study, but I couldn't bring myself to believe they sold anything that actually worked.

"We don't sell much that doesn't work," an unsmiling salesman behind the counter told me, "but some things work better than others. You're not from the papers are you?" Um. "Then I don't want to say too much about the good stuff. Any publicity is bad publicity as far as legal highs go." He didn't want to give me his name either, after a recent, unsought outing in the local press. This was because his head shop sold Spice, a controversial smokable product that had been on the market since 2006 but had come under the spotlight in 2009. Spice, to almost universal surprise, had been getting people high.

Last December, after initial murmurs in Germany about the legality of its ingredients, the UK's Advisory Council for the Misuse of Drugs began investigating Spice. In August, the Council recommended that the government ban Spice (and derivative products like it), and by 2010 it will be illegal – an "unparalleled" move, according to Martin Barnes, DrugScope's chief executive, who cannot recall another occasion in which a synthetic replica of an illegal drug has become illegal itself.

Head shops had found their breakthrough product, and quickly lost it. Could I still buy some? "The company that made Spice tried changing the brand and logo a few times, and eventually sold off the recipe," said the salesman. "They still make it in the Dominican Republic, I think, but it's not easy to get here any more." He scribbled down the phone number of a possible supplier ("a shaman in Holland") and sold me a small bag of something called Kratom instead. "It behaves like an opiate without any of the addictive qualities," he said, charging £15 for a gram of the dried leaves. "Stir the packet into a yogurt and eat it."

Later, following his instructions, and making a gritty mess of my peach Danone, I ate the kratom. It made me a bit fretful and urgent for an hour or two, a restlessness like that after one too many coffees, when you start to feel you ought to be writing a hit screenplay or enlisting to join wars. Some hours passed and I took an extraordinarily colourful visit to the loo.

Was there more to legal highs, I wondered, than this?

“We’re like a naughty Holland & Barrett”: John Clarke, a pharmacology graduate, and Jo Hall have been selling legal drugs since 2006. Photograph: Suki Dhanda

The industry presented a friendlier, more modern face in the home of John Clarke and Jo Hall, recent graduates from Birmingham University, who run an online retailer of legal highs called Coffeesh0p.com. The couple had propped a giant teddy bear next to a waist-high stack of Tupperware boxes containing colourful lotus leaves, powdered toadstool and Hawaiian woodrose seeds; above a chest of drawers stuffed with cardboard envelopes of guarano pills and pre-rolled kratom joints was a poster of Sean Bean in Sharpe.

"It pays the bills," said Clarke, 22, who started the business three years ago when he was studying for a degree in pharmacology. Today, his customers range from students attracted by the ease of shopping online, to professionals looking for substances that wouldn't show up on drug tests at work. There was a professor from the local university who made regular purchases; also a photographer, a shop assistant, and a yacht salesman. "We sold to a couple in their 30s last month. It was their anniversary, a weekend without the kids, and they wanted an interesting time. I think you'd be surprised that our customers are not just 18-year-olds wanting to get high. There's an entire culture of sensible people out there."

I was surprised at the appearance of some of my fellow shoppers on my visit to the head shop in Edinburgh. Yes, there was the shuffling student-type, and a group of twentysomething regulars who were pointedly told to come back later for something that couldn't be sold in front of me. But there was also a middle-aged woman, who looked for all the world like the respectable mother in an advert for margarine or a multi-surface cleaner. "Usual?" the salesman asked her, to which she affirmed, chatted for a minute or two about the weather, and left with three baggies of expensive Kratom.

"Legitimate transaction" is the draw, said Clarke – replacing the exchange of sweaty tenners on a street corner with a secure transaction by credit card. I spoke to one online shopper (who did not want to be named), and he agreed. "The price of the legal smoke is about the same as high-quality marijuana gram for gram, and even more in some cases. If these drugs were illegal they wouldn't be sold in anywhere near the numbers they are at the moment. But the ease of access is a huge advantage."

"We're trying to sell honest people honest stuff," said Clarke, who is galled that the law makes it impossible for him to give advice as to how to properly consume his products. Almost everything in Clarke and Hall's stockpile – from natural products such as Salvia divinorum, a psychoactive herb, to a synthetic snuff called Snow Blow – bore a label that warned it was "not for human consumption". And as we spoke, the couple were always careful to qualify any descriptions of use. "That's only really effective in a pipe or bong, should you smoke it… Traditionally this would be brewed into a… You might pipette a drop of that under your tongue, which we don't recommend…"

This is common practice (herbal entheogens are sold as "botanical souvenirs", smoking mixtures as "incense") and it causes problems. When gram-packs of woodrose seeds or a box of cactus bark arrive in the post, the customers will find a warning on the packet urging them to call a doctor if the product is ingested. People panic, and think they've been ripped off. "We'd rather not [have a label]," Clarke said, "but if you sell it without that label it then becomes a medicine, something that has to pass tests." That was where Spice went wrong, explained Hall. "They tried to change their classification from 'incense' to 'smokable product', and people started taking a closer look at the ingredients." The closer look was fatal, scientists in Germany discovering that, far from being a completely herbal mixture, as the packet had claimed, the buds in Spice had been sprayed with a chemical called JWH-018, which replicates the psychoactive effects of THC (tetrahydrocannabinol, the active chemical in cannabis) on the brain. Cue lockdown.

"The not-for-human-consumption thing is probably the worst thing, morally, that we do as an industry," said Hall. They likened their jobs to running a "naughty Holland & Barrett", but like my salesman in Edinburgh, the couple have to play a game of avoid-the-tide with legislators: legal highs need to be effective enough to attract a market, but not effective enough to attract the eye of the Advisory Council, which becomes aware of substances when they show up in amnesty bins at clubs, or when users report to treatment centres with problems, or when the tabloids start making a stink.

In the days leading up to my visit, news had broken that two more legal substances – BZP, a stimulant similar to ecstasy, and GBL, a derivative of GHB that had caused the death of a student in April – were to be brought under the Misuse of Drugs Act alongside Spice. "It was a blow when magic mushrooms were banned in 2005, but the industry survived," said Hall. "We're keeping our fingers crossed."

Clarke and Hall face an unforgiving legal crunch. "I'm not aware of any substance being taken out of the Misuse of Drugs Act," said Drugscope's Martin Barnes. "That is actually one of our concerns, that it is politically acceptable to bring substances in to the Act, or to increase their classification, but politically it doesn't seem possible to downgrade classification." He expressed a worry that thresholds might be starting to come down too low. "We need to have a better understanding of potential harms before making these substances illegal, with the fact that anybody caught using them will be committing a criminal offence."

"Sitting at home, smoking a joint of Spice and watching Sharpe. Doesn't sound like much of a crime, does it?" said Clarke.

Dr John Huffman, a 77-year-old professor of organic chemistry, was in his office at Clemson University in South Carolina last December when he received an email from Germany. It pointed him towards a news report in Der Spiegel, which revealed that a compound he had invented years earlier was being used in a legal smoking mixture of unusual potency. Well, thought Dr Huffman, what took you so long?

Huffman created JWH-018 (one of a hundred or so compounds known as "cannabinoids") in 1994, while conducting experiments for a US research institute. Research into cannabis-simulating substances began in the 1930s, moving through "an idiot phase when the American government planned to make 'happy moms' in the 1950s", to become of great interest to pharmaceutical companies in the 80s and 90s, hopeful that a medicine might be crafted that could recreate the pain-relief effects of cannabis without the intoxication. JWH-018 was "nothing special", Dr Huffman remembered, "but it was one of the more potent compounds we made, and it was quite easy to make from commercially available materials. Probably the reason it has now caught on."

After the article in Der Spiegel, a slew of people contacted him: the military in Germany, worried about use among their troops; drug enforcement agents and forensic scientists in the US; and entrepreneurs from around the world, wanting to know how to make it for themselves. To the latter, he always wrote back "Don't." But Dr Huffman had inadvertently jump-started an industry. "My biggest surprise was that this all hadn't happened sooner," he told me. "All it needed was somebody with a reasonable understanding of science to see the papers we had published and think, 'Aha!'"

After years of selling products that drew their effect from caffeine, or herbal combination, or simple wishful thinking, head shops found themselves with a product firmly grounded in science. "You could make JWH-018 for about $30 a gram, and a gram of the stuff would send you into oblivion forever," said Dr Huffman. "The enterprising chemists in China who make this stuff and sell it as plant growth hormone – yeah, right – have probably figured out an even cheaper way."

To find some Spice for myself I had to go on a tour of Midlothian head shops (the "shaman in Holland" had not come good), eventually finding some from the fugitive period when its producers were trying to evade closure. The packet bore a different name and logo but, I was assured, contained the Spice of infamy within. It smelled sickly sweet, heavily flavoured with the kind of synthetic fruit essence that is found in shisha tobacco, and it made my body weighty and sluggish when smoked. I didn't feel particularly euphoric; more disengaged so that I wouldn't have minded much if somebody had, say, punched me quite hard in the stomach.

Its potency was undeniable. I could suddenly picture them all – that initial curious customer, the army officers in Germany, US drug officials and our own Advisory Council – encountering Spice for the first time and having to stifle a great guffaw. This is legal!

"I've lived around the world a long time," said Dr Huffman. "I've come to the conclusion that if an enterprising person wants to find a new way to get high, they're going to do it."

There can be no better endorsement for a product that purports to make you high than for a government to confirm it does exactly that. John Clarke and Jo Hall knew whenever Spice was in the news because they would receive a week's worth of orders in a single day. New customers flocked to long-ignored head shops, enticed by the Spice frenzy.

One user I spoke to said that he was so impressed by the effects of Spice he immediately went online to investigate what else was out there. "I'd always thought the stuff you could get from your average head shop was laughable," said Tim, a 38-year-old sales manager from Surrey who preferred not to give his real name. He bought some Mephedrone, about which there had been some recent buzz ("It seems to be the most talked about with clubbers," Mixmag's features editor Duncan Dick told me). An amphetamine-like chemical that arrived in powdered form, it was supposed to have an effect similar to MDMA, and Tim gave it a go. He started with a 250mg dose, in a capsule, and the results were good – euphoria, stimulation – so he kept taking it, eventually consuming a gram in 12 hours. "I had taken a lot of amphetamines in the past and two or three grams over an evening was a reasonable amount for me. I wasn't worried."

But the next day, Tim woke up shaking and soaked in sweat, his heart beating frighteningly fast. The state persisted, along with near-permanent anxiety, for days. "I've had comedowns in the past where you feel a bit grotty for 24 hours and then after that you feel a bit better. This time, even a week later, I was genuinely struggling to function." His doctor prescribed Diazepam to calm the anxiety, but a month on, when we spoke, he was still feeling twitchy and on edge. Tim's error had been to base his dosage on Mephedrone's illegal equivalents.

DrugScope's recent survey highlighted the falling quality of street drugs as a reason why legal highs are growing in popularity. The Mephedrone Tim took was far cleaner than anything he was likely to have bought from a dealer. It had not been cut with chalk, or mashed-up aspirin, or Dreft detergent; it had been mass-produced in a factory, probably in China, imported by a wholesaler, and sold to him by a head shop – pure. He posted a description of his experience on an online drug forum, to warn others about making the same misjudgment.

This is another advantage of legal highs, according to Clarke. When people have better evidence as to what they've taken – because a substance bears a brand name, or because it is produced in a factory to roughly the same strength from dose to dose – effects can be compared with some kind of accuracy. Sites such as Drugs-Forum.com and Erowid.org throb with testimonials and advice. "With generic ecstasy there are so many different pills out there with different things in them that their effect is not going to be consistent," says Clarke. "It makes similar discussion almost impossible."

Most predict that Mephedrone will be the next substance to come under government review ("I imagine most users will be stockpiling supplies before the inevitable," said Mixmag's Duncan Dick). Martin Barnes told me that, even in the week leading up to our conversation, DrugScope had received an increase in calls from treatment centres, asking for information about the drug. "I don't want to give the impression that there are all these laboratories furiously trying to come up with new chemicals," he said. "But the traditional perception of what we meant by legal highs is changing. Head shops are selling more than just Kratom or Salvia, stuff to take to music festivals with a niche appeal. Spice and Mephedrone are something quite different, a couple of molecular tweaks away from controlled substances. That's a big challenge for legislators."

Mephedrone was the final legal high I tried. Already nervous after listening to Tim's tale, I was ratcheted up to a state of sheer terror by a warning from the salesman in Edinburgh that he knew it to be horribly addictive ("Should you decide to take it, which we don't recommend…"). But my experience was actually very pleasant. Even a relatively small dose had a significant effect: the urge to participate in every conversation in the room, the sudden conviction that I should have always known that it felt good to move my eyeballs around in their sockets. I took it with friends, many of those who had once suggested I smoke nutmeg, or tap up a dodgy barista for his whipped-cream can. All reported similar effects, and all asked the same question: "Is this really legal?"★