U.S. buyout firm Carlyle Group LP has agreed to buy between 30% and 40% of Spanish energy company Cepsa from Abu Dhabi state investor Mubadala, valuing the stake at as much as $4.8 billion.

The transaction marks the successful end of a quest by Mubadala for a new partner in Cepsa after it pulled the Spanish group's stock market flotation last year, citing uncertainty in international capital markets.

Mubadala said April 8 the deal gave Cepsa a total enterprise value of $12 billion.

Reuters had reported in March that Carlyle, with $216 billion of assets under management as of December, was ahead of other contenders to buy a 30% stake in Spain's Cepsa for up to 3 billion euros (US$3.4 billion).

Mubadala said the deal is expected to complete by the end of 2019, pending regulatory approval, and the final stakes of both parties will be confirmed at that time.

"We now look forward to working in partnership with Carlyle, which has a significant track record and energy sector capabilities, and with Cepsa’s management to further enhance and grow the business," said Musabbeh al Kaabi, Mubadala's CEO of petroleum and petrochemicals.

Mubadala, with assets of $225 billion including a stake in Carlyle, will remain the majority shareholder of Cepsa.

Madrid-headquartered Cepsa is Europe's largest privately-owned oil and gas company. It reported a 15% fall in annual adjusted net profit to 754 million euros last year.

Rothschild was sole financial adviser to Mubadala while HSBC and J.P. Morgan advised Carlyle.

Equity for the Cepsa investment will come from Carlyle International Energy Partners I and II, Carlyle Partners VII, and Carlyle Europe Partners V and co-investors.