President Trump wanted a quick solution to his Air Force One problem. The United States signed a $3.9 billion contract with Boeing in 2018 for two jets to be used as Air Force One, but a series of delays had slowed the work far past the 2024 delivery deadline, possibly beyond Mr. Trump’s second term. Now Mr. Trump had to fly around in the same old planes that transported President George H.W. Bush 35 years ago. It wasn’t just a vanity project. Those planes, which are no longer in production, require extensive servicing and frequent repairs, and officials from both parties, reaching back a decade or more, had been pressing for replacements. Mr. Trump, though, wanted a new plane while he was still in office. But how? “We’re the United States of America,” Mr. Trump said this month. “I believe that we should have the most impressive plane.” The story of how the Trump administration decided that it would accept a free luxury Boeing 747-8 from Qatar to serve as Air Force One involved weeks of secret coordination between Washington and Doha. The Pentagon and the White House’s military office swung into action, and Mr. Trump’s Middle East envoy, Steven Witkoff, played a key role. Soon after Mr. Trump took office, military officials started to discuss how the United States could buy a temporary plane for Mr. Trump to use while Boeing’s work creaked along, an investigation by The New York Times found. But by May 11, when the president announced on social media that Qatar would be providing the plane to the United States, he characterized it as “a GIFT, FREE OF CHARGE.” There are lingering questions about how much financial sense the still-unsigned deal would make, given the costs of refitting the plane for presidential use and operating it over the long run — or even whether the plane could be ready for Mr. Trump to use before the end of his second term. The outlines of the arrangement that emerged have also drawn condemnation from both Democrats and Republicans in Washington, as well as ethics lawyers, who said it looked either like Mr. Trump himself was taking the gift or that the Qataris were using it to curry favor with the administration. And it remains unclear exactly how a plan that Pentagon officials and others inside the administration initially assumed would involve buying the plane from Qatar morphed into a proposed gift by the Middle Eastern nation. Editors’ Picks How Much Notice Do You Have to Give Your Landlord? Should You Fly Through Newark Airport? Here’s What You Need to Know. How a Sustainable Clothing Entrepreneur Spends Her Sundays Qatar has denied any intention of using the transaction as part of an influence campaign, and Mr. Trump has said he would not use the plane after leaving office. Some elements of the effort to acquire the plane were reported earlier by CNN. Interviews with 14 people involved in or briefed on the search for the replacement plane say it started when the White House Military Office, which oversees presidential travel, worked with Boeing and the Defense Department to compile a list of every late-model 747 on the market with a business-jet layout, which could more quickly be retrofitted into a presidential plane. There were only eight planes in the world that fit the bill, including a flashy double-decker jet that Qatar had been trying to sell for several years, with no luck. A brochure for the aircraft advertised just the kind of opulence Mr. Trump favors. There were “soft fabrics of the highest quality” in the bedroom, along with “luxurious leather and exquisite wood veneers” and a “lavishly designed” bathroom that is “almost a piece of art.” The emir of Qatar had donated the same make and model to Turkey in 2018 as a gesture of support for President Recep Tayyip Erdogan. Mr. Erdogan had stood by Doha as the country’s bitter rivals in the region cut off diplomatic and transport ties with Qatar, effectively isolating it. But this second 747 was still available for sale. Mr. Witkoff, an old friend from Mr. Trump’s early days in New York real estate, knew the Qataris well. The country’s sovereign wealth fund had bailed him out in 2023 when a real estate deal on Central Park South went bad.