Cancer was slowly killing an old man in his fourth-floor apartment, and as the disease spread from organ to bone, sharp pains stabbed at his very core.

A clear, oblong patch was stuck to Shyam Sundar Nevatia's chest, just above his weakening heart, gradually releasing a 25-milligram dose of opium-based narcotic over three days. The medication was no match for the relentless pain as death drew near.

Nevatia's doctor had prescribed more-powerful morphine pills, but the 74-year-old businessman's family checked at hospitals and pharmacies, and even on the black market, without finding any.

India is the world's largest producer of legal opium, the raw material for codeine, morphine and other painkillers. But corruption and red tape have left thousand of Indians such as Nevatia to die in agony.

And strict licensing hasn't stopped drug gangs from diverting opium meant for medicines to smuggling routes shared by heroin and morphine traffickers, gunrunners and Muslim militants, police say.

"Organized crime and politics join together in this to make life miserable," said A. Shankar Rao, a zonal director with the Narcotics Control Bureau, a national police unit.

Mala Srivastava, the federal official who oversees the licensing system, denied that it had serious flaws.

"Whatever little diversion there is is internal," she said. "We have never heard of Indian opium, or Indian heroin, traveling abroad."

But the U.S. State Department's annual report on narcotics control strategy calls India "a modest but growing producer of heroin for the international market."

In an effort to keep opium out of criminal hands, India's federal and state governments license every step of the process, from growing poppies to stocking and transporting the painkilling drugs they produce.

But officials who issue the permits often don't answer the phone, are away from their desks or let applications languish for weeks, doctors and pharmacists complain. Sometimes hospitals run out of morphine while waiting for permit applications to work their way through the bureaucratic labyrinth.

"We have so many patients suffering," said Dwarkadas K. Baheti, a pain management specialist at Bombay Hospital, in India's largest city. "After two or three months, suddenly we have no morphine left, and for the next month, none is available. . . . I feel helpless. At times, I'm angry with myself."

The problems India faces have ramifications beyond the pain of its people. Afghanistan, which has the world's largest supply of illegal opium, is considering whether to license production for painkilling medicine, to channel opium away from the heroin market.

Experts with the Senlis Council, a French drug policy advisory group, are conducting a feasibility study in Afghanistan on the issue.

"Initial research reveals a serious lack of morphine and other opiates on the global medical market," the agency said when the study was announced in March. "Because of its present situation, Afghanistan could play an important role in the production of essential medicines for the world."

The study's results are to be released in September at an international drug conference in Kabul, the Afghan capital. Rao, the Indian counter-narcotics officer, said the Afghan government should learn from India's mistakes and do all it can to eradicate opium farming.

"This business has caused so much mess, I would say that if the Afghans want it to happen legally, it's the last thing they should have on their backs," Rao said. "They should go for some other thing. Ask them to grow tulips, or vanilla. They'll get a better price for it."

The United States imports 80 percent of its opium for pharmaceutical companies from India and Turkey, a policy that is due for review next year. In 2003, U.S. drug companies processed 357 tons of opium, almost two-thirds of global consumption, according to the most recent figures available from the International Narcotics Control Board.

Indians who have money often turn to an expensive opium-based medicine imported from the United States because it is easier to get than cheap, locally produced morphine. Nevatia's family paid a Calcutta pharmacist about $10 for each Johnson & Johnson Durogesic patch, more than five times the cost of a three-day supply of opium tablets.

But licensing hasn't stopped traffickers, aided by corrupt officials, from getting opium and other drugs, Rao said.

"With the support of local police and politicians, they convert this opium into smack," slang for heroin, said Vinod Kumar Shahi, a lawyer in Lucknow, capital of northern India's Uttar Pradesh state. Shahi has learned a lot about the drug trade in 20 years of defending many of the region's top gangsters.

By helping traffickers, police can earn 50 times their official monthly salary of about $230, Shahi said. So they pay large bribes to superiors to be posted at police stations in the opium belt of northern India, he said.

Stretching hundreds of miles, the belt is a harsh place, where a spring breeze can be like a blast from an oven and outlaw chemists work through the night by candlelight, turning opium gum into morphine base. Couriers move it up the supply chain to makeshift factories producing brown heroin.

Tons of tar-like opium gum are skimmed off India's legal supply each year and sent to the ad hoc chemists. With a plastic tub, a cup and chemicals easily found on the black market, they make the low-grade heroin base known as "brown sugar" on the street. There, illegal morphine is worth as much as 25 times what the government pays for it, said Rao, the counter-narcotics officer.

Afghan farmers last year produced about 4,200 tons of illicit opium, almost nine times India's legal harvest. The high-grade heroin produced from Afghan opium accounts for about 87 percent of the world supply, according to the United Nations.

India is a transit country for almost pure Afghan heroin, which is smuggled in from neighboring Pakistan, often in inflated tire tubes that are floated across rivers along the border. The two countries are nuclear-armed rivals, but their drug traffickers have long enjoyed excellent trade relations, Rao said.

India's opium route starts on small plots in Rajasthan, Uttar Pradesh and Madhya Pradesh, the only three states where farmers are licensed to grow opium poppies. They are also among the poorest and most corrupt and crime-ridden regions of the country.

The village of Jaithpur, in Uttar Pradesh state, is next to a brick-paved road that runs through fields of wheat, potatoes and mint. Children soap up and squat to shower beneath the spouts of hand pumps, and roadside tailors power sewing machines by pumping pedals.

In December, about 1,200 licensed farmers in the district planted white opium poppies on small plots. The plants grew like weeds in the arid winter of northern India, and by March, they were ready for harvest.

After the poppy petals dropped off, farmers lanced the ripe pods with small tools, and for as long as 10 days, they scraped up the sticky resin that oozed out. They were supposed to sell it all to the government, but police say many pounds of opium paste were diverted to local drug labs.

Several years ago, outsiders taught a few villagers the chemical process for turning opium into morphine base. In the village of Panihal, about 20 miles from the state capital, Lucknow, police raided one of the labs in the dead of night on April 13.

They found two men using a plastic jug to make crude morphine by candlelight in the middle of a date plantation, said state police sub-inspector Arun Kumar Shukla.

A squad of six police officers with flashlights captured one of the men, a suspected narcotics courier named Ashraf Sheikh, 25. They seized more than eight pounds of morphine and more than three pounds of crude morphine base, Shukla said.

But the suspected brains of the operation, Shera Jahoor, 32, somehow slipped the police net. Couriers are expendable, but men who know how to make morphine and heroin are essential to the narcotics trade, police said.

Jahoor has a talent for making narcotics, police said, and a knack for eluding justice. He has been arrested twice, and was out on bail in April. His brother is in jail awaiting trial on drug charges.

"There are many people around here who were arrested and are now out on bail," said Jaithpur Police Chief Girija Shankar Tripathi. He plunked the bundle of seized morphine down on his desk. It was the size of a bread loaf and so tightly sewn up in white cotton that the powder felt like a rock.

Police say Sheikh is an international trafficker with a list of contacts in neighboring Bangladesh, a prime destination for Indian narcotics.

Indian drugs also go south to Sri Lanka, where guerrillas with the Liberation Tigers of Tamil Eelam use money from heroin trafficking to fund their war for independence.

Meanwhile, those who need the painkilling peace of opium-based drugs go without.

A small tumor bulges from Dhruva Kumar Ray's waist.

He needs help to get up from his cot at the Nirmal Hriday, or Pure Heart, hospice run by Mother Teresa's Missionaries of Charity. It is where the unwanted and forgotten, many of them people living on Calcutta's streets, come to die -- and to reclaim a little dignity before they go.

"I feel a lot of moving pain in my legs and my hips. It's like something is gnawing at me. I've been assured by my doctor that if I'm operated on soon, I will live," the dying 32-year-old said, begging a reporter to take him to a hospital.

A few hours later, it was time for medicine, and a foreign volunteer gave Ray an antibiotic tablet and a cup of water. Patients receive painkillers only if a visiting doctor prescribes them. But morphine isn't in the nuns' medicine cabinets.

The hospice recently received a donation of morphine tablets but passed them on to a cancer hospital that needed them more, staff members said.

India's poor are used to suffering, but the shortage of opium-based drugs in hospitals is a crisis that hurts the rich, too.

Before he retired, Nevatia ran his own steel trading company and set up a charitable foundation to provide medicine to the poor in the name of his wife, who died of cancer.

But when his time came, he was unable to get the morphine he needed to ease his suffering.

After months of watching the former businessman slip closer to death, his 43-year-old son, Anant, turned to the Internet. He desperately looked up Web sites in the United States and Britain, hoping to get his father's morphine prescription filled.

Nevatia's family couldn't get a steady supply of sleeping pills. So two servants slept on the floor next to his pale blue steel-frame bed, ready to massage him with over-the-counter balms if he cried out in the night.

The heat was sweltering in Nevatia's home, where he chose to spend his final days among family -- as many dying Indians do. His windows opened onto central Calcutta's Chowringhee Street, and the dust and the din of honking horns drifted in on a hot breeze.

"The pain is spreading," Nevatia said from his bed, in a raspy whisper, in May. "It's all over the body. Sometimes, the pain moves slowly and sometimes it's intense."

Nevatia was reluctant to complain. A patient, strong-willed man, he accepted suffering as his fate and waited for death to bring peace.

On May 21, he died in his bedroom.

Shyam Sundar Nevatia, a cancer patient, had to resort to a narcotic patch because morphine pills weren't available.