WASHINGTON ― National security adviser Michael Flynn resigned late Monday, following revelations that he discussed U.S. sanctions against Russia with that country’s ambassador in the days surrounding their imposition ― and weeks prior to Donald Trump’s inauguration.

Retired Lt. Gen. Joseph Keith Kellogg Jr. will serve as acting national security advisor until a full-time replacement is named, the White House announced. Kellogg, as well as Vice Adm. Robert Harward and retired Gen. David Petraeus are the three candidates in line to succeed Flynn, according to the administration.

Flynn’s resignation came after a tumultuous few days of revelations about his ties to Russia and his role in attempting to ease sanctions that were put in place weeks before the Trump administration took office.

In late December, President Barack Obama announced the sanctions, which included the expulsion of 35 Russian intelligence operatives, in response to Russian interference in the November election designed to help Trump win.

Flynn at first denied that he had discussed the sanctions when he spoke with Russian ambassador Sergey Kislyak. He said the conversations concerned setting up a phone call between Trump and Russian leader Vladimir Putin and offering condolences after the murder of a Russian diplomat in Turkey.

But following a Washington Post report ― based partially on transcripts of the conversations ― Flynn’s office revised his earlier statements, and said that he couldn’t recall whether the topic of sanctions had come up. On Monday night, the plot thickened, with The Washington Post reporting that top officials at the Department of Justice warned the Trump administration weeks ago that Flynn might have been compromised by Russian influences and The New York Times reporting that the Army had investigated whether Flynn received payments from the Russian government in 2015.

As the revelations have piled up, the question has turned to why the Trump administration didn’t act sooner to sever ties. Trump has faced his own criticism for being too cozy to Russia.

When Putin’s response to Obama’s sanctions was uncharacteristically subdued, for example, Trump praised the Russian leader for his savvy. (Putin did not respond by expelling suspected American intelligence agents as is normally done, and instead said he hoped relations would improve after Trump took office.)

Trump also has been loath to concede the Russian actors played a role in the 2016 elections, even though U.S. counterintelligence agencies concluded in October that Russia and WikiLeaks ― which many in the intelligence community believe is a mouthpiece for Russian spy agencies ― were trying to interfere. A follow-up report released Jan. 9 added that Russia had been actively trying to help Trump and hurt his Democratic opponent, Hillary Clinton.

Flynn, like Trump, has advocated a closer relationship with Russia as an ally in the fight against Islamic terrorism. He appeared at an awards dinner honoring the Kremlin-sponsored RT network in 2015, at which he was seated beside Putin.

A retired Army lieutenant general, Flynn was considered an accomplished intelligence field officer but was fired from his job running the Defense Intelligence Agency in the Obama administration in 2014. In 2015, he began supporting Trump’s primary campaign, and was a featured speaker at the Republican National Convention last summer, when he led the crowd in chants of “lock her up,” regarding Clinton.

For this advocacy on the trail, Flynn enjoyed a tight relationship with Trump and got the plum foreign policy position in his administration when the election was over. Other Republican foreign policy operatives hesitated to work for him, making staffing inside the White House all the more difficult. But Trump remained committed, confounding others inside the administration who saw Flynn as toxic.

As recently as a few hours before the resignation was announced, White House counsel Kellyanne Conway had said that Flynn enjoyed the “full confidence of the president.”

That, clearly, turned out not to be true.