Correction: A previous version of this story gave the incorrect location of BlackBerry’s headquarters. It is based in Waterloo not Ottawa, Canada.

Fairfax has offered a $4.7 billion bid for BlackBerry. Above, a BlackBerry salesperson displays a BlackBerry Z10 during the launch of the BlackBerry 10 smartphone in Mumbai February 25, 2013. (VIVEK PRAKASH/REUTERS)

BlackBerry announced Monday that it has agreed to be acquired by Toronto-based Fairfax Financial Holdings Limited for $4.7 billion.

The beleaguered smartphone company said it had signed a letter of intent with Fairfax, which owns about 10 percent of BlackBerry’s common shares. The deal would deliver about $9 a share to shareholders and take the company private.

Once an essential accessory for Washington insiders, BlackBerry has faltered in its competition with popular smartphones such as Samsung’s Galaxy and Apple’s iPhone. It has just 3 percent of the worldwide smartphone market, according to a second-quarter report by the IDC research firm.

“This is BlackBerry’s last ditch attempt to simply survive in the face of crushing competition in a market it essentially invented,” said Anthony Michael Sabino, a business professor at St. John’s University.

Last week, the company announced it will lay off 4,500 employees, about 40 percent of its workforce, and post nearly $1 billion in losses in its second quarter. The firm said that most of its writedown would come from its inability to clear stockpiles of its latest BlackBerry 10 device, which it once considered critical to its turnaround efforts.

After trading in the company’s stock was briefly halted, the shares rose about 1 percent after the announcement Monday. They closed at $8.82. The company’s stock has fallen about 14 percent during the past month.

Despite its declining fortunes, BlackBerry was considered an attractive takeover target. It has $2.6 billion in cash, no debt and coveted software and hardware patents, analysts have said.

The Waterloo -based company, formerly known as Research in Motion, said a special committee will consider alternative offers to the Fairfax consortium proposal during what is called a “go-shop process.”

“Importantly, the go-shop process provides an opportunity to determine if there are alternatives superior to the present proposal from the Fairfax consortium,” Barbara Stymiest, chairman of BlackBerry’s board of directors, said in a statement.

The Wall Street Journal has reported that BlackBerry co-founder and former co-chief executive Mike Lazaridis could make a bid for the company.

A sale could provide the company critical breathing room, eliminating the pressure to meet shareholders’ expectations as it refocuses on business and government consumers. It has traditionally dominated this market, building a reputation for security that won over government clients such as the White House and the Defense Department.

But in recent years, government agencies have loosened their policies, allowing workers to connect work e-mail to their own devices and providing another challenge to BlackBerry.

Finding a market for phones that can be used for work and play is key to BlackBerry’s survival, though the firm may see that market dwindle over time as well, said Brian Proffitt of the University of Notre Dame.

“As Apple and Android improve their respective enterprise and device management tools, BlackBerry’s advantage even there may diminish,” Proffitt said.

“It’s not the devices and hardware where BlackBerry has value, but rather its software and mobile device management service.”

In a statement, Fairfax chairman and chief executive Prem Watsa said: “We believe this transaction will open an exciting new private chapter for BlackBerry, its customers, carriers and employees. We can deliver immediate value to shareholders, while we continue the execution of a long-term strategy in a private company with a focus on delivering superior and secure enterprise solutions to BlackBerry customers around the world.”