miners
Miners prepare for their last working day at Hungary's last hard coal deep-cast mine at Markushegy Dec. 23, 2014. Kompania Weglowa had been threatening to close four mines in Poland but a deal Saturday averted the closures. Reuters/Laszlo Balogh

WARSAW (Reuters) - The Polish government and unions reached a deal on Saturday to keep open the mines of Europe's biggest coal producer Kompania Weglowa after more than a week of protests against plans to restructure the company.

The government said this month it planned to shut down four of Kompania's 14 mines in the south of Poland, leaving some 5,000 workers without jobs.

According to the deal, the government may now merge mines with state-controlled energy firms.

Protests in the southern Silesia industrial region began last week in the four mines earmarked for closure and workers from other mines followed suit on Monday.

"We saved those who work in Kompania Weglowa from a terrible thing - a bankruptcy and losing all their jobs," Poland's Prime Minister Ewa Kopacz said in a joint statement with regional head of Solidarity union Dominik Kolorz.

"This is a difficult restructuring program, (but) we kept alive ... virtually all of the mines which were destined for liquidation," added Kolorz.

Kopacz's Civic Platform party faces a general election in October.

Kompania employs a total 49,000 people, accounting for around half of all workers in the country's mining sector.

Details of the deal were not revealed, but Kolorz said that the restructuring plan will involve linking mines with electricity producers.

"The most important thing is the targeted capital merger with the energy sector," the union leader said.

The state controls four of Poland's big energy companies: PGE Polska Grupa Energetyczna, Enea, Energa and Tauron Polska Energia.

Tauron on Friday expressed an interest in buying Brzeszcze, one of Kompania's loss-making mines previously targeted for closure.

The owner of construction materials producer Selena FM Krzysztof Domarecki has expressed his interest in taking over some ailing coal mines from Kompania. Another interested entrepreneur is politician Janusz Palikot.

The four mines earmarked for closure made a 1.9-billion zloty ($511.30 million) loss over the past three years, hit by rising operating costs and falling coal prices.

Poland is considering merging its four major power producers into two companies strong enough to compete with larger European rivals and support the country's flagging coal industry, according to sources.