Thousands of people enraged by blackouts rioted on Friday in the northern Indian state of Uttar Pradesh, setting fire to substations and taking power company officials hostage.

Power cuts have plagued the northern Indian state of Uttar Pradesh over the past few days, triggered by the extreme heat.

The state of Uttar Pradesh never has enough power for its population of 200 million. Many people only receive power for a few hours a day, and over 60 percent of homes have no access to electricity at all.

Recent temperatures have soared to 47C, which has led to a dramatic spike in the demand for power, from 8,000 megawatts to 11,000 megawatts. The resulting blackouts have shut down air conditioning units and water pumps.

Thousands of people stormed an electricity substation on Friday near the state capital of Lucknow, ransacking offices and taking several workers hostage. The ordeal ended after 18 hours when police intervened.

In Gonda, 180km to the southeast of Lucknow, an angry mob set fire to an electricity substation, which took firefighters three hours to extinguish.

A fire was also started in Gorakhpur, 320km southeast of Lucknow.

Uttar Pradesh Chief Minister Akilesh Yadav said officials were trying to purchase power from other states, though they were also facing shortages amid the extreme heat.

Residents had been particularly angry about the power cuts after receiving reliable supplies through the Indian elections, which ended May 16. Since then, only some regions have been guaranteed unbroken power supplies, while others have received little to none.

The High Court in the city of Allahabad is now hearing a petition alleging discrimination in power distribution, and has asked the government to explain why some regions appeared to be receiving preferential treatment.

Those regions include the city of Varanasi, the parliamentary constituency of new Prime Minister Narendra Modi, as well as constituencies held by Yadav and other top officials in Uttar Pradesh's ruling party.

Meteorological officials said temperatures would likely remain above average until at least Tuesday in Uttar Pradesh, Gujarat, Delhi and other areas of northern India.

Even if the temperature does drop back down to the average, Lucknow still expects temperatures of 38C ahead of the monsoon rains. This is certainly uncomfortable without power.