Twitter’s board had reached the end of the road.

It was April 24. Ten days earlier, Elon Musk, the world’s richest man, had made an unsolicited bid to buy Twitter for $54.20 a share. Alarmed by the out-of-the-blue proposal and uncertain if the offer was for real, the social media company had adopted a “poison pill,” a defensive maneuver to stop Mr. Musk from accumulating more of its shares.

But by that Sunday, Twitter was running out of choices. Mr. Musk had lined up financing for his offer and was needling the company with his tweets. And after hours of discussions and reviewing Twitter’s plans and finances, the questions the 11 board members were wrestling with — could the company be worth more than $54.20 a share? would any other bidder emerge? — were all leading to one dissatisfying answer: No.

Less than 24 hours later, the blockbuster $44 billion deal was announced.

“What I’ll tell you is that based on the analysis and the perception of risk, certainty and value, the board unanimously decided the offer from Elon represented the best value for our shareholders,” Bret Taylor, Twitter’s chairman, told the company’s more than 7,000 employees on Monday in a call that The New York Times listened to.

A central mystery of Mr. Musk’s acquisition of Twitter is how the company’s board went from installing a poison pill to agreeing to sell to him in just 11 days. In most megadeals, the adoption of a poison pill leads to a protracted fight. The tactic is a clear signal that a company intends to battle. Negotiations then drag out. Sometimes buyers walk away.

But interviews with a dozen people close to the transaction, who were not authorized to speak publicly, show just how few options Twitter’s board had.

And while there are many types of buyers that deal advisers are prepared to fend off — hostile ones, aggressive ones, those who lowball and then are willing to negotiate — Twitter faced an acquirer in Mr. Musk who was not in any deal playbook. In essence, he was an “unknown quantity” acquirer, one who would not budge on price and was prepared to publicly trash the company and wield his considerable fortune to get an agreement done with limited diligence.

“Normal buyers might actually say, ‘Well, you know, we actually want to talk to the folks inside and see how is the business going and get more data than is available to the public,’” said Edward Rock, a professor of corporate governance at the New York University School of Law. “What was interesting,” he said, is that the Twitter board “reached a deal in a short period of time — and such an unconditional deal.” He called the deal’s speed “unusual.”

Twitter declined to comment on its board discussions. Mr. Musk did not respond to a request for comment.

The groundwork for a deal was laid in January, when Mr. Musk began buying Twitter stock, eventually building up a more than 9 percent stake in the company. When he made his holdings known in a securities filing in early April, Twitter offered him a board seat. Mr. Musk briefly agreed to the idea before changing his mind.

Instead, on the evening of April 13, Mr. Musk sent a text message to Mr. Taylor, who has been Twitter’s chairman since 2016. (Mr. Taylor is also a co-chief executive of the software company Salesforce.)

“I am going to send you an offer letter tonight, it will be public in the morning,” Mr. Musk wrote to Mr. Taylor. The exchange was included in a securities filing.

The next morning, a bare-bones offer letter arrived from Mr. Musk. It declared his intention to buy Twitter for $54.20 a share, but it had few details about his plans for the company or the financing.

Mr. Musk hired the investment bank Morgan Stanley, tapping the services of two bankers, Anthony Armstrong and Michael Grimes. Mr. Grimes, who heads Morgan Stanley’s technology banking practice, led the 2012 public stock offering of Facebook and other tech companies, while Mr. Armstrong was a longtime tech banker who had recently been promoted to company vice chairman.

Twitter’s board did not quite know how to handle Mr. Musk’s bid, the people with knowledge of the discussions said. Mr. Musk did not have a track record of buying companies and had not followed through on some deals, including one in 2018 when he tweeted that he would take his carmaker, Tesla, private but then did not do so.

A day after Mr. Musk’s bid became public, Twitter’s board voted unanimously to slow him down by authorizing the poison pill. To defend itself, Twitter turned to Goldman Sachs, its longtime banker, and JPMorgan Chase. For legal advice, it added the law firm Simpson Thacher & Bartlett to supplement its longtime law firm, Wilson Sonsini.

JPMorgan declined to comment. Morgan Stanley, Goldman Sachs and Simpson Thacher didn’t immediately have comments.

Mr. Musk was undeterred. His bankers began trying to corral tens of billions of dollars in financing for a Twitter deal. His advisers presented prospective lenders with a few pages vaguely outlining Mr. Musk’s goals. The billionaire also talked directly with banks, a person with knowledge of the calls said.

That helped persuade Citigroup, Bank of America, BNP Paribas and other banks to put their money in. Despite a lack of details about Mr. Musk’s plans, lenders were reassured in part by the entrepreneur’s past successes and wealth, the person said.

Mr. Musk also campaigned on Twitter for a deal. He hinted that he would take his proposal directly to shareholders in a so-called tender offer if the company’s board did not accept his bid. On April 16, he tweeted, “Love me tender.” Three days later, he tweeted “____ is the Night,” a reference to the F. Scott Fitzgerald novel, “Tender Is the Night.”

Twitter’s board fractured. On April 16, Jack Dorsey, a Twitter founder who stepped down as chief executive in November and is a board member, tweeted that the board had been the “consistent dysfunction of the company.” When asked by a Twitter user whether he was allowed to say that, Mr. Dorsey responded, “no.”

Mr. Dorsey’s criticism rankled other board members and Twitter executives, said two people who worked on the deal. Mr. Taylor asked Mr. Dorsey to stop tweeting negatively, one person said. Mr. Dorsey continued posting references to Twitter’s board.

A spokesman for Mr. Dorsey declined to comment. A spokeswoman for Mr. Taylor declined to comment.

On April 21, Mr. Musk lined up $46.5 billion in financing. He had obtained commitments from Morgan Stanley and other lenders for $13 billion in debt financing, while another group of banks promised $12.5 billion in loans against his stock in Tesla. Mr. Musk added that he would use another $21 billion in cash to buy the rest of Twitter’s equity.

The financing forced Twitter’s board to take Mr. Musk seriously. No other offers for the company had emerged, two people familiar with the deliberations said.

At Twitter, Mr. Taylor weighed employee uncertainty and the societal implications of a deal versus the board’s fiduciary duty, people with knowledge of the situation said. That meant making a decision based on whether Twitter could reasonably achieve a value better than what Mr. Musk had put forward.

Mr. Taylor and other board members debated whether Twitter’s user and revenue growth prospects were realistic. The San Francisco company, which had not turned a profit for eight of the last 10 years, had set aggressive business targets.

Twitter had also initially benefited from the pandemic, attracting a surge of new users and sending its stock to more than $77 in February 2021. But its advertising business lagged those of competitors, and as the pandemic boost wore off, its shares fell below $40.

Still, some board members were wary about having a saviorlike figure such as Mr. Musk swoop in, especially since Twitter had already relied upon such figures — including Mr. Dorsey — to right the ship, two people said.

Mr. Musk began preparing to start a tender offer for Twitter, said one person close to the discussions. He had a potential ally on Twitter’s board in Egon Durban, a co-chief executive of the private equity firm Silver Lake, who had worked with Mr. Musk on his failed 2018 effort to take Tesla private. But Mr. Durban made clear to the board that Silver Lake was not teaming up with Mr. Musk to provide financing for a takeover, two people said.

Through a spokesman, Mr. Durban declined to comment.

Last Saturday, Mr. Musk spoke with Mr. Taylor and threatened to take his offer directly to Twitter’s shareholders, without explicitly saying he would start a hostile bid, a person with knowledge of the call said.

On Sunday, Twitter’s board concluded that it had to make a deal with Mr. Musk. The company could not hit $54.20 a share on its own, board members agreed, and no white knight was coming.

Mr. Taylor told Mr. Musk that Twitter would proceed with a sale, a person with knowledge of the call said. Even so, Mr. Musk sent a letter to Mr. Taylor threatening a hostile bid.

Twitter’s advisers homed in on protections for the deal, like a breakup fee if Mr. Musk walked away and a six-month timeline to closing the deal, which could be particularly important if technology stocks continue to fall. Mr. Musk’s advisers shored up financing details, with the billionaire personally signing off on each point, a person familiar with the negotiations said.

After the agreement was announced on Monday afternoon, Mr. Musk took a victory lap.

“Yesss!!!” he tweeted, posting emojis of rockets, stars and hearts.

Anupreeta Das, Maureen Farrell and Kate Conger contributed reporting.