Fairfax Financial Holdings has agreed to acquire BlackBerry in a deal worth $4.7 billion, both companies announced Monday.

The Toronto-based financial holdings conglomerate has agreed to pay $9 per share for the beleaguered mobile company — a premium of about 9%. Shares of BlackBerry were trading at $8.23 per share before a freeze was initiated.

It's not a done deal yet: According to the terms of the agreement, Fairfax can walk away at any time. Fairfax already owns approximately 10% of BlackBerry common shares.

News of the takeover comes two days after BlackBerry announced it was cutting 4,500 jobs — about 35% of its workforce — and taking a loss of nearly $1 billion in its second quarter.

How the mighty have fallen. At its peak in mid-2007, BlackBerry was worth more than $100 billion. Should the transaction go through, BlackBerry will go private for 2/3rds the price of Nokia, which Microsoft agreed to acquire in September for $7.2 billion.

BBRY data by YCharts

Image:Timothy A. Clary/Getty Images