A team of researchers has developed a simple paper-based test that can in a matter of seconds detect whether a person has recently been using cocaine.

The method can potentially be applied to a variety of substances. The researchers plan to make a business case for the technique as a safe, rapid and highly accurate method of running a variety of drug tests in the real world.

The team, from institutions in the Netherlands and the United Kingdom, published their findings Friday in the journal Clinical Chemistry.

The technique involves a method called "paper spray mass spectrometry." This allows researchers to determine the identity of a substance by measuring the mass of its molecules.

Since molecules of cocaine have a unique mass, the spectrometer can detect their presence. The test can also detect the metabolites that result from the body processing cocaine.

"It can detect cocaine and metabolites of which is further proof that cocaine has gone through the body and is excreted," said lead researcher Catia Costa, a researcher at the University of Surrey in the United Kingdom, in an interview with CNBC.

The team tested 39 people, some known users of cocaine and some non-users. The test was 99 percent effective. A sample can be analyzed in 30 seconds, Costa said, which is extremely fast. Most conventional lab-based drug tests take several hours to days to return results. The new test also does not involve taking samples of blood, hair or urine, making it less invasive and safer, Costa said.

It works like this: First, a fingerprint is collected on a small triangular piece of paper. Then the paper is placed on a mass spectrometer, the instrument that measures the various masses of different molecules and atoms.

The researchers then pour a solvent on the paper and send a small electrical charge through the paper, which releases the molecules and sends them into the spectrometer's analyzer and detector, which measure and record the mass of the molecules.

The method could, in theory, be used to test a variety of drugs. The team has already been able to detect heroin.

They have also added a fingerprint identification step to the process, which in a real-world application would ensure the sample came from the person meant to take the test.

The test could potentially be used in any of the usual situations where drug tests are needed, such as workplaces, legal situations, hospitals and treatment centers. The test could also be used in emergency situations, such as overdoses. Rapidly running a few tests could allow paramedics or doctors to determine what sorts of substances might be responsible for an overdose.

Finally, Costa said, doctors might be able to use it to ensure patients are taking prescribed medications.

Costa said she soon plans to spend three months talking to people in industry, health care and other areas to explore the business case for the product.

The research was funded by a company called Intelligent Fingerprinting, a company that does other fingerprint-based drug tests, and the UK's National Institute for Health Research.