India's top court on Tuesday stayed a nationwide ban imposed by Prime Minister Narendra Modi's government on the sale of cattle for slaughter that had provoked outcry in many states.

The Supreme Court upheld a decision by a lower court staying the ban imposed in May, which prohibited the sale and purchase of cows ─ an animal considered sacred for Hindus ─ for slaughter.

The sudden ruling had sparked protests against what many saw as an overreach by the Hindu-right Bharatiya Janata Party (BJP), and many states where cow slaughter was legal vowed to fight the decree.

Petitioners in the southern state of Tamil Nadu launched the first challenge, claiming the ban infringed their right to eat what they choose, a flashpoint issue in the Hindu-majority nation.

Allegations of cow slaughter and beef consumption against Muslims and other minorities have triggered murders and violent reprisals in India, where many are vegetarian.

In its ruling, the Supreme Court said the government had already given it a commitment that it would review the rules on the sale of cattle for slaughter.

Some states organized “beef fests” in the days after the ban was announced to protest the measure, while counter rallies by BJP supporters saw cows adorned with flowers.

The national government said the ban aimed to regulate the industry and ensure the welfare of animals, which often suffer cruelty in markets.

But it threatened to constrain India's supply of beef and leather, two lucrative export industries worth billions.

The slaughter of cows, as well as the possession or consumption of beef, is banned in most but not all Indian states. Some impose up to life imprisonment for infringements.

The federal ban affected not just the trade in cows but bulls, bullocks, buffaloes, calves and camels.

Modi's BJP pledged to impose a countrywide ban on the slaughter of cows ahead of the 2014 national elections, but the federal government failed to persuade opposition parties to back such a law.