The Indian supreme court has refused to allow one of the world's leading pharmaceutical companies to patent a new version of a cancer drug, a decision campaigners hailed as a major step forward in enabling poor people to access medicines in the developing world.

Novartis lost a six-year legal battle after the court ruled that small changes and improvements to the drug Glivec did not amount to innovation deserving of a patent. The ruling opens the way for generic companies in India to manufacture and sell cheap copies of the drug in the developing world and has implications for HIV and other modern drugs too.

Campaigners were jubilant. A ruling in Novartis's favour would have reduced poor people's access to the drug, said Jennifer Cohn, of Médecins Sans Frontières (MSF). "The fact that India says patents are to reward innovation as opposed to small changes does stay true to the concept of what a patent should be."

But Novartis said the decision "discourages future innovation in India". Ranjit Shahani, the firm's vice-chairman and managing director in India, said the ruling was "a setback for patients that will hinder medical progress for diseases without effective treatment options".

He said the Swiss company will be cautious about investing in India, especially over introducing new drugs, and seek patent protection before launching any new products. It will continue to refrain from research and development activities in the country. "The intellectual property ecosystem in India is not very encouraging," Shahani told reporters in Mumbai after the ruling.

Glivec is an important drug in the treatment of myeloid leukaemia and has transformed prospects for patients in rich countries. It is a targeted, biological therapy that blocks cancer growth in patients with a particular gene mutation. But like all targeted therapies, it is very expensive, costing more than £1,700 a month.

Historically India only had limited patent protection on drugs and generic companies in the country made versions of many medicines. It was only when Indian firms began to make cheap copies of HIV drugs that it became possible more than a decade ago to contemplate the treatment of millions of people in impoverished countries of Africa, where the Aids epidemic was at its worst.

But in 2005, India became compliant with World Trade Organisation rules on intellectual property and now grants patents on innovative new drugs. Patents usually run for 20 years or more from the date they are taken out.

Glivec was already on the market, however, so Novartis decided to seek a patent on a slightly altered version, potentially giving it a longer period of market exclusivity. The supreme court has thrown out the application, saying the new drug is not significantly different from the old version, and ordered Novartis to pay costs.

At stake in the legal battle was not just the right of generic companies to make cheap drugs for India once original patents expire but also access to newer drugs for poorer countries in much of Africa and Asia. India has long been known as the pharmacy of the developing world.

Dr Unni Karunakara, the president of MSF, said: "The supreme court's decision now makes patents on the medicines that we desperately need less likely. This marks the strongest possible signal to Novartis and other multinational pharmaceutical companies that they should stop seeking to attack the Indian patent law."

In a statement, the Cancer Patients Aid Association in India (CPAA), which had opposed the patent application, said: "We are very happy that the court has recognised the right of patients to access affordable medicines over profits for big pharmaceutical companies through patents. Our access to affordable treatment will not be possible if the medicines are patented. It is a huge victory for human rights."

The case hinged on the interpretation of section 3(d) of the Indian Patents Act, which does not allow patents of new versions of known drug molecules, unless they make the medicine significantly more effective than before.

Novartis argued that better physicochemical qualities, such as shape of the molecule, stability, hygroscopicity and solubility, would satisfy the test of enhanced efficacy.

But the court decided that the changes were simply an attempt at "evergreening" – refreshing the drug so that a new patent would be granted – which is common practice in Europe and North America.

Anand Grover, senior counsel and director of Lawyers Collective HIV/Aids Unit, who represented the CPAA in the courts, said: "The supreme court's interpretation of section 3(d) keeps it intact. It is alive and kicking. It gives life to parliament's intent of facilitating access to medicines and of incentivising only genuine research.

"By refusing patent monopolies on minor changes to known molecules, this judgment will facilitate early entry of generic medicines into the market for other medicines and diseases too. The impact will be felt not only in India, but also across the developing world."

The ruling is thought likely to affect drugs belonging to several other companies. Pfizer's cancer drug Sutent and Roche's hepatitis C treatment Pegasys lost their patented status in India last year. They may now find it harder to obtain a patent on new versions.

In an interview with before the ruling, Novartis threatened to stop supplying India with new medicines if it did not get the patent protection it believes its investment and innovation deserve. "If the situation stays as now, all improvements on an original compound are not protectable and such drugs would probably not be rolled out in India," Paul Herrling, who headed the company's legal battle in India, told the Financial Times. "Why would we?"