TORONTO — BlackBerry has agreed to sell itself for $4.7 billion to a group led by largest shareholder, Fairfax.

BlackBerry said Monday that a letter of intent has been signed and its shareholders will receive $9 in cash for each share.

Fairfax head Prem Watsa is a former board member who owns 10 percent of BlackBerry. Watsa stepped down when BlackBerry announced it was considering a sale last month. The billionaire is one of Canada’s best-known value investors.

Trading of the company’s stock was halted ahead of the news. BlackBerry shares plunged after the company announced Friday a loss of nearly $1 billion and layoffs of 4,500 workers.

The BlackBerry, pioneered in 1999, was once the dominant smartphone for on-the-go business people and other consumers before Apple’s iPhone debuted in 2007.