New Delhi (CNN Business) PepsiCo has backed down from a controversial fight with Indian farmers it accused of illegally growing its registered potatoes.

The company is withdrawing a lawsuit it filed last month against four small Indian farmers for growing a potato variety it had registered for exclusive use in Lays potato chips.

"After discussions with the [Indian] government, the company has agreed to withdraw cases against farmers," a PepsiCo India spokesperson said in a statement. "We are relying on the said discussions to find a long term and an amicable resolution of all issues around seed protection."

PepsiCo had offered to settle with the farmers, but found itself under increasing pressure from agricultural unions and activists to drop the suit.

The lawsuit thrust the giant American food and beverage company into a debate about the rights of India's hundreds of millions of farmers — a political base vital to Prime Minister Narendra Modi's hopes of winning a second term in national elections over the next three weeks.

Read More