Bangalore has developed a serious water shortage in recent years

India's water-starved tech hub Bangalore won a reprieve on Friday when the country's top court altered a river-sharing agreement in its favour, ruling on a bitter dispute that dates back more than a century.

The Supreme Court said a 2007 ruling by a special tribunal on river-sharing had failed to take into account Bangalore's growing needs, and awarded a greater share to the southern state of Karnataka.

Bangalore was once known as India's garden city for its many lakes and parks, but has developed a serious water shortage in recent years as workers have flocked there to take up jobs in the tech industry.

Known as the Silicon Valley of India, the Karnataka capital is one of the country's fastest-growing cities with a population of more than 10 million.

The river-sharing issue has become hugely emotive in the city, which suffered deadly protests in 2016 when the Supreme Court ordered Karnataka to release extra water from the Cauvery river to ease a shortage in neighbouring Tamil Nadu.

Hundreds of companies were forced to close and public transport services were cancelled as thousands took to the streets.

Appasamy Navaneethakrishnan, the lawyer for the Tamil Nadu government in the case, said Friday's ruling was a setback for the state.

The Cauvery river rises in Karnataka and flows into the Bay of Bengal through Tamil Nadu

"We will study the judgement in depth and we will take appropriate steps," he told reporters outside the court.

The Cauvery rises in Karnataka and flows into the Bay of Bengal through Tamil Nadu.

Its waters—fed by India's annual June to September monsoon rains—irrigate crops and provide drinking supplies for both Karnataka and Tamil Nadu.

The modern dispute began in 1974, when an 1892 agreement on the sharing of the waters lapsed.

That was the year when the British Madras presidency, now Tamil Nadu state, forced the Maharaja-ruled Mysore—modern Karnataka state—not to use the Cauvery waters without its permission.

A tribunal set up in 1990 awarded Tamil Nadu 419 billion cubic feet (11.9 billion cubic metres) of the estimated total of 740 billion cubic feet of Cauvery waters. Karnataka was given 270 billion cubic feet.

The two have repeatedly resorted to legal action to win a bigger share of the waters.

Under Friday's ruling, Karnataka's share will increase to 285 billion cubic feet.