(Adds quote, background on Czech refining sector) By Jan Lopatka PRAGUE, July 3 (Reuters) - Oil processing firm Unipetrol UNPE.PR is to buy out the stake of Italy's ENI ENI.MI in their joint refining firm Ceska Rafinerska, Unipetrol said on Thursday, giving it full control of the Czech refining sector. Unipetrol, majority owned by Poland's PKN Orlen PKN.WA , said it would pay 30 million euros ($40.9 million) for the 32.4 percent stake it did not already own in the firm, which operates the country's two refineries at Litvinov and Kralupy. The acquisition, for which Unipetrol had right of first refusal, followed a bid by Hungary's MOL MOLB.BU to buy the ENI stake. Czech refineries have been losing money due to a squeeze on margins and overcapacity among European refineries, and ENI's disposal follows the example of Royal Dutch Shell RDSa.L , which sold its 16 percent stake in Rafinerska earlier this year, also to Unipetrol. ID:nL5N0L536O ID:nL6N0NG381 Unipetrol said its latest acquisition would give it the ability to carry out a deeper restructuring of the company, without giving any details. PKN had been in talks with the Czech government to secure the future of the refining sector and had proposed to merge its operations with Czech oil and oil product pipeline firms, Mero and Cepro. ID:nA5N0NZ01J But the Czech government rejected that option, saying it wanted to keep control over strategic infrastructure. Finance Minister Andrej Babis said in April that one option in the refining sector was for the government to consider buying the Kralupy refinery to secure its continued operation. ID:nL6N0NG4XG MOL agreed in May to take over ENI's chain of petrol stations in the Czech Republic and also bid for the stake in the refineries. ID:L6N0PE4XG Unipetrol's refineries have a conversion capacity of 8.7 million tons of crude oil per year, coming through a pipeline from Russia and another link bringing oil from the Adriatic port of Trieste. The acquisition was announced after the market close in Prague. Unipetrol shares had closed 0.5 percent lower at 128 crowns, the lowest closing level since September 2009. ($1 = 0.7331 Euros) (Editing by David Holmes) ((jan.lopatka@thomsonreuters.com)(+420224190474)(Reuters Messaging: jan.lopatka.thomsonreuters.com@reuters.net)) Keywords: UNIPETROL RAFINERSKA/