One evening last December, retired Lt. Gen. Michael Flynn exited the White House Situation Room after attending transition meetings with members of the Obama administration.

As the incoming national security adviser walked toward the West Wing exit, a young Obama administration official held open the door for them.

"After you, sir," the staffer said to Flynn as he passed, according to a person who was there.

Flynn paused and put his hand on the official's shoulder. "I can't wait to take over this place," he said.

The former general's guilty plea to lying to the FBI on Friday punctuated a stunning fall for an ambitious, hard-charging general who was one of the nation's premier counterterrorism officials.

For Flynn, who helped the U.S. military hone a process for tackling the most dangerous insurgencies, the plea in a federal-district court in Washington marks a likely end to his public life.

Michael O'Hanlon, a senior fellow at the Brookings Institution, said Flynn demonstrated restraint and political acumen when he served as a top intelligence officer in Iraq and Afghanistan.

"Many of the same virtues that were characteristic of [that] period of his life seemed to have been lost in how he handled the Trump phenomenon," O'Hanlon said.

The son of a veteran and the brother of another senior Army officer, the Rhode Island native thrived as an intelligence officer. In the tumultuous years following the Sept. 11, 2001, attacks — as the U.S. military struggled to adapt to battles against shadowy enemies in Iraq and Afghanistan — Flynn burnished his reputation as a savvy, effective officer.

In Iraq, Flynn served under Gen. Stanley A. McChrystal, who led the development of an accelerated process for using nightly Special Operations raids to obtain and exploit critical intelligence.

"Mike was pure energy," McChrystal wrote in his memoir of then-Col. Flynn, describing an innovative, highly focused deputy. "He had an uncanny ability to take a two-hour discussion or thicket of diagrams on a whiteboard and then marshal his people, resources and energy to make it happen."

Later, McChrystal made Flynn his chief intelligence officer when he took over the war in Afghanistan, applying the lessons of Iraq to a new battlefield.

Flynn was known to be an approachable boss who sent emails to aides at all hours because he seemed to never sleep. He sometimes sent close aides lengthy handwritten notes to express his gratitude.

But Flynn was also known as a nonconformist — someone who wasn't afraid to voice criticism or buck the rules. At times, those instincts created problems, prompting a reprimand after sharing privileged information with partner forces in Afghanistan.

In 2012, Flynn was tapped to head the Defense Intelligence Agency (DIA). There, the general's hard-driving style and his plans to shake up an agency often overshadowed by the CIA, created friction with his staff and with officials at the Pentagon.

His promotion to running an entire agency exposed his weaknesses on policy issues and poor judgment as a manager, former officials said. In 2014, Flynn was forced out of the DIA about a year ahead of schedule.

Once out of government, Flynn's behavior, which had raised eyebrows among intelligence officials when he was at the DIA, began to raise wider alarms.

In late 2015, Flynn attended a dinner celebrating RT, the television channel and website that the U.S. government has labeled a Kremlin-run propaganda machine. At the dinner, Flynn was photographed sitting next to Russian President Vladimir Putin, a striking image at a time when Russia was the subject of international censure for its intervention in Ukraine.

Partly because of that reputation, these people said, Flynn did not get a big corporate job or well-paid consultant gig as many other former intelligence chiefs did. Instead, he ran his own small shop and became one of the first, and most high-profile former military leaders to back Donald Trump's candidacy.

At the GOP convention in Cleveland in July 2016, Flynn gave an impassioned speech against Hillary Clinton and led the crowd in a raucous chant of "Lock her up!''

Flynn told the crowd: "If I did a tenth of what she did, I would be in jail today.''

Michael Ledeen, who co-authored a 2016 book with Flynn called "The Field of Fight," said Flynn was known throughout his career for unusual candor. "He's one of those people who actually does speak truth to power, whether they like to hear it or not," Ledeen said.

When they were working together closely in 2015 and 2016 on the book, Ledeen gave Flynn a piece of advice: Don't ever meet with FBI agents without a lawyer present. Ledeen, who has since been interviewed by special counsel Robert S. Mueller III's team, thinks Flynn "didn't listen too carefully."

After Trump won the election, Flynn was expected to get the national security adviser position, one of the most sensitive posts in the U.S. government. Two days after the election, President Barack Obama met with Trump in the Oval Office and, in a moment that deviated from the meeting agenda, warned him against hiring Flynn, according to former officials, who like others spoke on the condition of anonymity to discuss internal deliberations. Flynn was the only Trump loyalist whom Obama singled out for criticism.

Despite policy disagreements, Flynn came across as civil and respectful during meetings with Obama administration officials, according to officials present.

But he also talked frequently of his discussions with Russian officials, so much so that some involved in the transition process became concerned he might be too friendly with those officials, according to people familiar with the discussions.

Then, in December, he had phone calls with Sergey Kislyak, the Russian ambassador in Washington, that forever altered his life. The conversations, intercepted by the FBI because agents monitor foreign ambassadors' communications, involved discussions of U.S. sanctions against Russia, as well as negotiations in the United Nations.

On Friday, Flynn admitted to lying about both of those issues when FBI agents interviewed him Jan. 24.

After that interview, the White House tried to ride out the storm and keep Flynn in his position. After it was revealed the FBI was investigating Flynn's conversations, a White House spokesman insisted sanctions were not discussed, mentioning a handful of other topics that were.

Those comments further alarmed law enforcement officials, who knew the majority of the discussions Flynn had with Kislyak in late December were about sanctions, according to people familiar with the matter.

Within the Justice Department, the spokesman's comments raised concerns that others were lying publicly on Flynn's behalf — making the problem worse, according to people familiar with the matter.

Even after Flynn was pushed out of the White House, Trump sought to get the FBI to drop the Flynn probe, according to people familiar with the discussions. As that issue festered, Trump eventually decided to fire then-FBI Director James B. Comey.

Mueller is probing the events leading up to that firing — and the president's discussions about Flynn — to determine whether the president may have sought to obstruct justice, according to people familiar with the matter.

As Flynn left the courthouse Friday, a crowd of onlookers was waiting outside with a familiar chant: "Lock him up."

Greg Jaffe and Spencer S. Hsu contributed to this report.