The takeover was engineered by Poland's Bank Guarantee Fund (BGF), which was set up to support stability in the Polish financial system and is responsible for resolving issues with financial institutions at risk of bankruptcy.

Idea Bank's owner Leszek Czarnecki denounced the takeover as illegal in a statement on his lawyer's Facebook page, saying he would sue for damages and appeal against the decision.

Others welcomed the takeover, which had long been expected due to Idea Bank's financial difficulties. Pawel Borys, the chief executive of Polish state fund PFR, said on Twitter it meant "one less risk in the banking sector in 2021".

Pekao's acting Chief Executive Leszek Skiba said in a statement the deal would generate shareholder value through synergies and secure the larger bank's capital and liquidity position.

Polish prosecutors have accused Czarnecki of cheating Idea Bank's clients and exposing the lender to a significant loss. Czarnecki's lawyer has dismissed the allegations, saying they are politically motivated.

Skiba said Pekao would not be affected if Czarnecki won damages.

Idea Bank declined to comment.

Pekao will receive a subsidy of up to 218 million zloty to help cover Idea Bank's capital gap of 482.8 million zlotys ($130 million), the head of the BFG said.

Under the terms of the deal, Pekao will acquire some of Idea Bank's assets and liabilities, excluding corporate bonds issued by debt collector GetBack. All customer deposits and loans will be transferred to Pekao.

The takeover will be effective on Jan. 3, Pekao said, with full operational integration expected by the end of 2021.

Two of Pekao's management board members resigned on Thursday over "a different vision of the bank's development", the lender said in a separate statement.

Idea Bank's net loss narrowed to 37.3 million zloty in 2019 from 1.9 billion zloty a year before. It reported a 5.2 million zloty net profit in the third quarter.

($1 = 3.7141 zlotys)

(Reporting by Anna Pruchnicka in Gdansk, Anna Koper, Anna Wlodarczak-Semczuk and Alan Charlish in Warsaw; Editing by David Goodman, Barbara Lewis and Jan Harvey)