South African homes, offices and businesses have endured a week of daily power cuts, designed to prevent a total collapse of the overstretched electricity grid.
The use of scheduled blackouts, or load shedding, is not new in the country - but the latest round has been the most disruptive yet, sparking a public outcry. As the state-owned power utility, Eskom, battles to meet demand, it has warned that it could run out of money by April, defaulting on its vast debt.
Eskom is one of the biggest power utilities in the world, while South Africa is the most-industrialised country in Africa.
The crisis at the utility poses a huge threat to the economy and to the political survival of President Cyril Ramaphosa, who faces an election in May.
What are the roots of the crisis?
The latest round of rotating blackouts has been attributed to maintenance issues at Eskom power stations. However, this is not the first time the utility has resorted to load shedding. Similar measures were introduced late last year, as well as in 2008 and 2015.
In fact, the current crisis is the result of a perfect storm in which rising costs, falling revenues, crumbling infrastructure, and decades of corruption and mismanagement each play a part.
Eskom generates almost all its electricity from coal, an abundant resource in South Africa. Its fleet of coal-fired power stations were producing more than enough energy to meet the country's needs when white-minority rule ended in 1994.
Demand soared after that, driven by rapid economic growth and by the extension of coverage to deprived black townships. The BBC's Milton Nkosi in Johannesburg says Eskom acquired millions of consumers in the post-apartheid years, but its expansion was hindered by poor governance.
Swift action was needed to feed the grid, but none was taken. Only with shortages looming in the mid-2000s did the government announce a costly overhaul, including plans for two huge new power plants - Kusile and Medupi.
What happened to the overhaul?
Kusile and Medupi were meant to have become fully operational by 2015, but their construction has been beset by spiralling costs, delays and corruption scandals.
Of the six CEOs appointed to lead Eskom over the course of a decade, Brian Molefe was among the most promising, analysts say, earning credit for addressing maintenance problems and construction delays.
But he quit after only a year in the job, after being accused by an anti-corruption body of helping the interests of the Gupta family, which was in business with the son of the president at the time, Jacob Zuma.
Mr Molefe, the Guptas, Mr Zuma and his son have all denied allegations that they acted illegally.
Today, the showpiece Kusile and Medupi plants are still years from completion, while their projected cost has doubled, weighing down Eskom's finances.
The price of coal has meanwhile gone up, as has the cost of employing a workforce that is almost 50% larger now than it was 10 years ago. The utility has been forced to hike tariffs, which has contributed to a drop in sales.
Wealthier customers and businesses have been turning towards renewable sources of energy, such as solar panels, whose cost has come down. Poorer municipalities that continue drawing power from the Eskom network are meanwhile falling behind on payments, contributing to the debt.
How bad is the crisis at Eskom for South Africa?
The load shedding further cuts into Eskom's revenues and also hurts the economy at large, lowering industrial output and business productivity. But the cost of temporary power outages is nothing compared to the potential damage to the economy if Eskom were to go bust.
The firm has recently been described by government officials as "technically insolvent" and in a "death spiral". It owes nearly 420bn rand (£23bn; $30bn) - an enormous sum on which it can barely even afford the interest payments.
More than half of Eskom's debt is guaranteed by the government, accounting for 15% of the national debt. International banks have described Eskom as the single biggest threat to South Africa's economy.
To save Eskom, the government could be asked to inject more money into the utility, and to assume responsibility for yet more of its debt.
But it is not clear where the government would find the resources to do so. The economy is already faltering and any bailout of Eskom could harm South Africa's credit rating, making matters worse.
What are the possible solutions?
The government is considering splitting Eskom into three companies, one each responsible for generation, transmission and distribution. Many industry analysts believe that this could make the sector more competitive, and therefore more efficient.
But the plan is opposed by powerful labour unions, who worry that the move will lead to privatisation and job losses. The unions have resisted attempts to trim the workforce, and recently won a fight for pay rises at the cash-strapped firm.
Versions of the plan to split Eskom have been tabled by successive governments since the 1990s, without any success. But with the crisis at the utility now threatening the economy, the need for decisive action has never been greater.
The government may also consider giving Eskom a bigger role in South Africa's nascent renewable energy sector. The utility currently buys renewable energy from small independent providers, for distribution across its grid.
Regardless of what action is taken, it is unlikely that South Africans have seen the last of load shedding.
According to independent energy expert Ted Blom, the utility bears most of the blame for the current crisis.
"You cannot run an organisation in trouble with a restricted budget," he said, criticising the lack of investment in basic maintenance. "This was self-inflicted by Eskom."