Canada’s Osisko Mining Corp. has announced a $3.6 billion deal selling most assets to Yamana Gold Inc. and AEM, beating back a hostile takeover by top miner Goldcorp Inc. Central is Osisko’s flagship Canada Malartic gold mine, a huge, low-cost asset in politically stable Québec.

The new agreement contains a 50% sale of Osisko shares to both Yamana and AEM, with a cash injection by two Canadian pension funds. Osisko shareholders will own Yamana and AEM cash and shares with stock in the new Osisko entity, said company officials; analysts forecast the deal will get investor preference.

Both companies will jointly operate Malartic, where production began in 2011 after Montreal-based Osisko officials raised $900 million and persuaded local residents to relocate. The companies will further explore, and potentially develop, Osisko’s Kirkland Lake assets, while exploration at the Hammond Reef, Pandora, Wood-Pandora properties continues, said company officials.

The new Osisko spinoff, meanwhile, will enjoy royalties, cash and exploration assets at its 100% owned land package in Guerrero, Mexico. “This is the best outcome that we could possibly come to,” Osisko Chief Executive Sean Roosen said, as quoted by Reuters; Q1 2014 gold production, he added, stood at 366,421 oz.

The Latin America-focused, Toronto-headquartered Yamana will thus have its first major Canadian project; the move will also enhance AEM’s already-significant Quebec portfolio through production and costs, said company officials. Malartic, they added, has no permitting, construction or startup risks.

The news came minutes after Vancouver-based Goldcorp announced a proxy bid to replace Osisko’s entire board of directors with its own officials at Osisko’s annual May meeting. In Q1 2014, Goldcorp announced a $2.3 billion cash-and-share offer straight to Osisko shareholders after both miners held sporadic talks over five years.

Finalization, expected by June, is pending approval by two-thirds of Osisko shareholders; Yamana and AEM shareholder approval is unnecessary. Altogether, Osisko shareholders will own 16.7% of Agnico Eagle, and 14.4% of Yamana.