NHS patients are to be given cannabis as part of a government-funded trial.
Some patients will receive cannabis-based medicines
The study, which is being run by the Medical Research Council, aims to find out if the drug really can help to relieve pain.
Scientists will randomly select 400 patients who have undergone surgery from 36 hospitals across the UK to take part in the study.
They will be given one of four pills after undergoing surgery, two of which will be a form of cannabis.
They will receive a capsule containing standardised cannabis extract or a capsule containing tetrahydrocannabinol - the active ingredient in cannabis.
The remaining patients will receive either a standard pain-relieving drug or a dummy pill.
Researchers will ask the patients about their pain and general well-being at least once every hour while they are awake, over a six hour-period. The patients will be able to request additional pain relief at any time.
The researchers will then be able to compare the experiences of patients in each of the four groups and, hopefully, determine whether the cannabis-based treatments are effective.
The £500,000 trial is being headed by scientists at Imperial College London.
"Many patients and clinicians want an answer to the question of whether cannabis is effective at relieving pain," said Dr Anita Holdcroft, who will lead the study.
"We need to assess the scientific merits of some of the anecdotal evidence and we need to do this in the same way as any other experimental pain treatment.
"This is a proper study in a clinical setting where patients can be routinely monitored, using an oral capsule containing a prescribed dose."
Studies have suggested that cannabis and cannabis-based medicines can help to relieve pain.
Richard Spencer, who was paralysed 23 years ago after breaking his legs, said using the drug as part of a medical trial took away his pain, relaxed spasms in his legs and allowed him to sleep.
"Without it, I don't know what I would do," he told BBC Radio 4's Today programme.
"I just wish it was available 20 years ago, I would have used it. Certainly, I would have had quality in my life."
Last year, a small trial involving 34 British patients with multiple sclerosis, spinal cord injury and other conditions causing severe pain, found that using cannabis-based treatments reduced their pain and helped them to sleep more soundly.
Researchers have also found evidence to suggest it can help to reduce the side effects of chemotherapy treatment given to cancer patients.
In the United States, the Food and Drug Administration has approved the oral use of dronabinol, a cannabis derivative, for people with Aids.
There is evidence that cannabis may stimulate the appetites of Aids patients with wasting disease.
It may also help relieve the pain of menstrual cramps and childbirth.
Claims have also been made for its use in treating asthma, strokes, Parkinson's Disease, Alzheimer's Disease, alcoholism and insomnia.
However, opponents of the use of cannabis point to the fact that it damages the ability to concentrate and, if smoked, may increase the risks of developing lung cancer.
The British Medical Association has said that only cannabinoids - part of the cannabis plant - should be used in medicine.
Frank Warburton, director of Drugscope, a charity that comments on drug-related policy, said: "The therapeutic benefits of
cannabis have been well-known for some time.
"We welcome this trial which appears to be a sensible and rational exploration of these benefits, and look forward to seeing the results of the evaluation."