Qatar has agreed to pay $12 million for fuel for the Gaza Strip’s sole power plant, in a move that seeks to end the serious energy crisis gripping the Palestinian enclave.

Gaza is currently experiencing the worst electricity shortage in years, with power supplied to households only three to four hours a day in a cold winter.

In recent weeks, Gaza residents have staged spontaneous demonstrations, including a demonstration Thursday night that saw thousands of Palestinians streaming through the streets of Jabaliya, located in the northern part of the Strip, demanding more electricity. Hamas cracked down on the dissent, arresting protesters and targeting journalists covering the protests.

Qatar agreed to the deal following a meeting Sunday in Doha between Hamas Deputy Political Leader Ismail Haniyeh and Sheikh Tamim bin Hamad Al Thani, emir of the State of Qatar, Hamas said in an online statement.

Following the meeting, according to the statement, the Qatari leader ordered “urgent action to implement a number of steps to resolve the electricity crisis in Gaza.”

The Chairman of the Qatari National Committee for Reconstruction of Gaza, Muhammad al-Amadi called the Acting Director of the Palestinian Energy Authority Zafer Milhem, and told him Qatar agreed to pay four million dollars a month over the next three months, the Hamas-linked site Pal Info Center reported.

Palestinian Authority Prime Minister Rami Hamdallah confirmed the $12 million deal in statement to the official PA news outlet Wafa. He attributed the deal’s success to Abbas’s “continual communication” with Qatar.

The two million residents of Gaza require around 450-500 megawatts of power per day, but are receiving less than half of that. With cold winters, demand has spiked — leading to the shortages.

On Saturday, Turkey pledged to send 15,000 tons of fuel to the Gaza Strip in an effort to end the crippling electricity shortage in the Palestinian enclave.

A Palestinian girl does her homework during a power cut in the Al-Shati refugee camp in Gaza City, on January 4, 2017. (AFP/Mahmud Hams)

A Palestinian girl does her homework during a power cut in the Al-Shati refugee camp in Gaza City, on January 4, 2017. (AFP/Mahmud Hams)

Energy authorities are desperately cash-strapped, in part because of unpaid bills. Nearly 70 percent of households do not pay their electricity bills, either because they can’t afford it or because of lax collection, the UN estimates.

Life has become increasingly difficult for Gaza’s 2 million residents, who are squeezed into the tiny coastal territory. Hamas’s violent takeover a decade ago triggered a border blockade by Israel and Egypt that, among other things, sharply aggravated power shortages.

Hamas seized control of Gaza from Fatah, which dominates the PA, in a bloody battle in 2007.

The two factions have been unable to form a unity government and have been in an extended dispute over tax bills on fuel imports.

AP and AFP contributed to this report.