A court in India on Friday lifted a state ban on Coca-Cola and PepsiCo drinks, which had been imposed after an environmental group said they contained unsafe levels of pesticides.

The ban on the production and sale of the drinks was imposed by the communist rulers of the southern state of Kerala in August.

The two U.S. firms had told the court in a petition that the ban was unconstitutional and their products were safe to consume.

The High Court quashes the order of the Kerala government banning Coke and Pepsi production and sale, chief justice V.K. Bali said in a courtroom in the city of Kochi.

The controversy erupted when the New Delhi-based Center for Science and Environment (CSE) said its tests showed that samples of drinks of both companies across the country had dangerously high levels of pesticides.

The court said the CSE report could not be basis for the ban.

The order of Kerala government was based on the CSE report which the High Court does not rely upon, Bali said, delivering the verdict.

Last month, a federal government-appointed panel said CSE failed to prove its claims and there were inconsistencies in its chemical analysis of the soft drinks.

Coca-Cola welcomed the court judgment.

We are gratified that High Court of Kerala has set aside the illegal orders of the Government of Kerala, the company said in a statement. We will immediately take necessary steps to make Coca-Cola available across the state of Kerala.

PepsiCo said its products complied with health standards in India and abroad.

Besides Kerala's complete ban, six other states have imposed partial bans on Coca-Cola and PepsiCo products by prohibiting sales at or near schools, colleges and hospitals.

The companies hope the Kerala order would prompt other state to lift restrictions.

We hope that other state governments will reconsider similar ban orders/advisories issued by the them, Coca-Cola said.

At around $1.29 billion, annual sales of Coca-Cola and PepsiCo products in India account for only a miniscule part of their global business but the CSE report and state bans have cut into local sales and hurt their reputation among many consumers.

Consumer groups say that most farm products in India, including fruits, milk and vegetables and pulses are contaminated with chemicals including harmful levels of pesticides.

Some experts say most farmers dose their crops with pesticides up to 15 times a day when it should be done less than five times.