Last February, Michael Flynn, who was then the national-security adviser, huddled with top aides in his White House office. Flynn had been under fire for days, since press reports revealed that he had misled the Vice-President and other officials regarding his contacts with Russia’s Ambassador to the United States, Sergey Kislyak. Flynn’s deputy, K. T. McFarland, spoke for the group when she appealed to her boss to try to save his job by talking with President Trump directly, according to people in the room. She argued that it would be a mistake for Flynn to surrender to his opponents so quickly. Flynn chose not to follow McFarland’s advice, telling aides that he would leave the decision to the President. That night, he handed in his resignation letter.

A year later, McFarland faced her own choice. At the end of 2017, the Senate sent her nomination to serve as Trump’s Ambassador to Singapore back to the White House, after Democrats accused her of misleading lawmakers regarding her own knowledge of Flynn’s contacts with Kislyak. Instead of heeding congressional warnings about her dim prospects for Senate confirmation, Trump re-nominated her for the Singapore post, earlier this month. Even though most White House officials consider it hopeless, McFarland recently told friends that she is preparing for another round of meetings with senators, hoping to somehow pull through. “She still thinks she has a shot,” one friend said. A senior congressional aide said of McFarland’s unwillingness to concede defeat, “I feel sorry for her.”

McFarland’s tenure in the Trump White House began auspiciously. After Trump’s Inauguration, she moved into “the Suite,” a cluster of offices on the first floor of the West Wing reserved for close aides. McFarland ’s office was the size of a closet, but she made room for a two-person couch and a pair of dining-room-style chairs so that members of her team could meet more informally there, instead of downstairs in the Situation Room.

To give the space a more personal touch, McFarland put on display one of her most cherished family heirlooms: an American flag salvaged from her father-in-law’s warship during the Second World War. She added photographs, news clippings, and other mementos from her time working as a member of Henry Kissinger’s National Security Council staff, in the nineteen-seventies, and later as a speechwriter to Secretary of Defense Caspar Weinberger, under President Ronald Reagan.

Some N.S.C. veterans thought that McFarland, a Fox News commentator who hadn’t served in government in three decades, was ill-suited for the job of deputy national-security adviser, a position that typically entails working longer hours than anyone else in the West Wing and helping oversee high-stakes government programs and covert action. But her organizational skills—compared to those of other senior officials in a chaotic White House—and her welcoming, open-door approach won over many junior staffers, some of whom came to see her as “the N.S.C.’s mom.” During her brief tenure at the N.S.C. under Trump, McFarland was known to cut off her intelligence and counterterrorism briefers mid-sentence to ask, “Did I offer you coffee or tea?” McFarland also played a hands-on role in steering early policy debates, including a “soup-to-nuts” review of options to counter North Korea’s nuclear program, officials said. (One of those options, which was quickly rejected, called for accepting North Korea as a nuclear state.)

It was McFarland’s mentor, Kissinger, who had personally recommended her to Trump for the job. Trump, who admired McFarland’s work on Fox, called her on Thanksgiving Day to offer her the position.

During the transition, McFarland forged a close working relationship with Flynn. When they weren’t in meetings together in Trump Tower, Flynn and McFarland communicated frequently by phone and e-mail. In December, 2016, Kislyak contacted Flynn to discuss sanctions imposed by the Obama Administration to punish the Kremlin for interfering in the U.S. Presidential election. Flynn consulted McFarland about what, if anything, he should convey to the Russian Ambassador. For reasons that remain unclear, Flynn falsely told Vice-President Mike Pence and F.B.I. agents that he had never discussed sanctions with Kislyak. Those errors led to Flynn’s resignation and, later, to his guilty plea for making false statements to the F.B.I.

After Flynn’s departure, McFarland held the Suite together, aides said. Members of her staff credited her with running an efficient operation. Then, on February 20th, Trump appointed H. R. McMaster as Flynn’s replacement. When McMaster made it clear that he wanted to appoint his own deputy, McFarland was presented with other opportunities in the Administration, including possible ambassadorships. One of the few important diplomatic postings in Asia that had not already been filled was Ambassador to Singapore. McFarland told an N.S.C. official that going abroad could help her escape the political firestorm over Russia. If things went well in Singapore, she could possibly return to Washington in two years to assume a higher-level position.

Officials said that Trump was conflicted about McFarland’s departure from the N.S.C. He was fond of her and told her on several occasions that he liked having her as the deputy national-security adviser. “What would you rather do, go to Singapore or stay here? Are you sure you want to go?” Trump asked her, according to one official. McFarland chose Singapore, and Trump submitted her nomination, though he continued to ask her if she was certain she wanted to go.

In May, lawyers representing Trump’s transition requested that the General Services Administration, the organization that housed the servers used by the transition, provide them with copies of transition e-mails and calendars, including McFarland’s. The lawyers agreed to share whatever they received from the G.S.A. with McFarland and her staff, to help her prepare for her confirmation hearings. But, when McFarland’s team later asked the lawyers for her transition documents, the lawyers said that the G.S.A. had yet to release them, presumably because they were of interest to the special counsel Robert Mueller. Transition lawyers wouldn’t get a full set of McFarland’s e-mails until November. (The G.S.A. didn’t respond to requests for comment.)

McFarland’s interview with Senate Foreign Relations Committee staff members went ahead, as planned, on July 19th, even though she couldn’t review her e-mails or calendars beforehand. During the closed-door session, staffers asked McFarland if she took part in any phone calls with Russian officials during the transition. According to officials, McFarland answered that she served as a note-taker during transition phone calls with the Russian President, Vladimir Putin, and the Russian foreign minister, Sergey Lavrov. After the interview, committee staff members checked and found only one call, in November, between Trump and Putin, which was before McFarland joined the transition, and no call with Lavrov. Aides said that McFarland had botched her answers. She was forced to send a clarification letter to the committee, acknowledging that her recollections of the calls were mistaken.

On July 20th, McFarland appeared before the Senate Foreign Relations Committee for her confirmation hearing. That same month, Senator Cory Booker, a Democrat from New Jersey, had given McFarland a series of written questions, including one about whether she had ever discussed “contacts with Russian Ambassador Sergey Kislyak directly with General Flynn?” McFarland’s curt written response read, “I am not aware of any of the issues or events as described above.”

With support from Republicans and a single Democrat, McFarland cleared the Senate Foreign Relations Committee on September 19th, but the nomination languished for months, never advancing to the Senate floor for a vote. Then, on December 1st, Flynn pleaded guilty to a single count of lying to the F.B.I. about the contents of his communications with Kislyak. In court papers accompanying his plea agreement, federal investigators disclosed that Flynn had coördinated his contacts with Kislyak with an unnamed senior transition official, who was later identified as McFarland.

The disclosures prompted Booker to accuse McFarland of giving false testimony. He called her answers “another example of a pattern of deception on the part of Trump’s closest associates regarding their connections and communications to Russian government officials.” Veterans of the Senate Foreign Relations Committee say that the surest way for a nomination to be withdrawn is for a nominee to be accused of lying to senators. One of the Administration’s lawyers said that McFarland should have been able to recall at least some of her telephone and e-mail exchanges with Flynn regarding Kislyak, even if she couldn’t get access to her e-mails and calendars.