The Food and Drug Administration, drug companies and doctors mishandled distribution of a powerful fentanyl painkiller, allowing widespread prescribing to ineligible patients despite special measures designed to safeguard its use, according to a report released Tuesday.

The unusual paper in the medical journal JAMA relies on nearly 5,000 pages of documents that researchers obtained from the government via the Freedom of Information Act, rather than a more typical controlled scientific study.

The researchers concluded that prescribers, pharmacists, drug companies and the FDA — despite agreeing to special rules and monitoring for use of the opioid — had allowed it to go to thousands of inappropriate patients. The FDA and drug companies became aware this was happening but took no action, researchers found.

Using five years of insurance claims data, the researchers found that about 35 to 55 percent of patients shouldn’t have received the drugs.

“The whole purpose of this distribution system was to prevent exactly what we found,” said Caleb Alexander, co-director of the Center for Drug Safety and Effectiveness at the Johns Hopkins University Bloomberg School of Public Health. “It should never happen. It’s a never event. And yet we found it was happening in 50 percent” of the cases.

Some of the problems researchers identified were discussed at an FDA advisory committee meeting in August. Afterward, FDA Commissioner Scott Gottlieb tweeted that “we share the concerns about how these drugs are being used and whether the … program is working as intended.”

The researchers looked at the distribution of pharmaceutical fentanyl for cancer patients experiencing “breakthrough pain” despite receiving opioids round the clock. The fentanyl, marketed under several names by different companies, is about 100 times as powerful as morphine. According to the FDA, about 5,000 people in the United States receive such prescriptions at any one time.

The strength of pharmaceutical fentanyl products and their quick absorption pose a serious risk of overdose, abuse and addiction for anyone who hasn’t built up a tolerance to opioids. To guard against prescribing to such patients, the FDA created a plan in which drug companies, doctors, pharmacists and patients received special instruction on the use of the drugs and signed up to be part of the small group allowed to prescribe, dispense and take them. Drug companies and the FDA monitored prescribing.

But the report contends that those safeguards didn’t work. In an assessment of claims data after four years, the drug industry told the FDA that about half of patients who took the drugs had not built up tolerance to opioids according to FDA standards.

A report after 60 months determined that 35 to 55 percent of patients were ineligible, depending on the product, the researchers reported. The FDA concluded that its primary goal of keeping the drug out of the hands of ineligible patients was not being met.

Doctors have authority to prescribe medications for problems other than those on the drug packaging. But in this case, the drugs were specifically prohibited for patients who weren’t tolerant of other opioids.

Drug companies were supposed to boot doctors and others who wrongly prescribed the drugs. But the researchers said no prescriber was cut.