CNN  — 

Chad Wolf is resigning as the acting secretary of Homeland Security, he said in a letter to the department Monday obtained by CNN.

Federal Emergency Management Agency Administrator Pete Gaynor will be the new acting secretary, taking over in the wake of the US Capitol attack and as the national security apparatus prepares for possible violence leading up to Inauguration Day.

“I am saddened to take this step, as it was my intention to serve the Department until the end of this Administration,” Wolf wrote, citing ongoing litigation challenging the validity of his appointment.

“Unfortunately, this action is warranted by recent events, including the ongoing and meritless court rulings regarding the validity of my authority as Acting Secretary. These events and concerns increasingly serve to divert attention and resources away from the important work of the Department in this critical time of a transition of power,” Wolf added.

Wolf was in the chief role at the department in an acting capacity for 14 months. His tenure has repeatedly come up in litigation against the Trump administration’s immigration actions, most recently last week regarding asylum limits.

Wolf is the latest Cabinet secretary to resign in recent days, though his letter did not cite last week’s riots. Betsy DeVos, who served as education secretary, and Elaine Chao, who was transportation secretary, have also resigned.

House Homeland Security Chairman Bennie Thompson called the timing of Wolf’s resignation “questionable,” citing the concerns about the legality of his appointment.

“He has chosen to resign during a time of national crisis and when domestic terrorists may be planning additional attacks on our government. Unlike others, he is apparently not leaving the Trump Administration on principle,” the Mississippi Democrat said, adding that Wolf’s number two, Ken Cuccinelli, should also resign over questions about his authority.

Heading into a week with the FBI warning of warning of possible armed protests at all 50 state capitols and at the US Capitol, almost all the key national security agencies are being run by acting leaders, including the Department of Justice and Department of Defense. DHS will now have a new chief with only nine days until Inauguration Day.

Before announcing he was stepping down Monday, Wolf said he had instructed the US Secret Service to begin National Special Security Event operations for the inauguration on Wednesday instead of January 19, citing in part “events of the past week and the evolving security landscape leading up to the inauguration.”

Last week, Wolf urged President Donald Trump and all elected officials to condemn the violence on Capitol Hill in a sharply worded statement, while vowing to stay in his position until President-elect Joe Biden takes office.

“What transpired yesterday was tragic and sickening. While I have consistently condemned political violence on both sides of the aisle, specifically violence directed at law enforcement, we now see some supporters of the President using violence as a means to achieve political ends,” Wolf said. “This is unacceptable.”

On Thursday, it was revealed that the White House had withdrawn Wolf’s official nomination to the secretary post, sparking concerns among DHS officials about whether Wolf could legally stay, according to a source familiar with the discussions.

Last Friday, DHS legal counsel spoke to the Office of Legal Counsel about the withdrawal and the legal implications for the secretary role, according to another source.

Wolf’s legitimacy has been a struggle for the department and has threatened to derail policies and other actions put in place during his tenure.

Former DHS General Counsel John Mitnick, who served in the Trump administration, wrote that the withdrawal of Wolf’s nomination “raises the issue of whether he “can continue to perform the functions of the Secretary.”

“Chaos to the last,” Mitnick tweeted last week.

Wolf has been serving as chief of the Department of Homeland Security – the third largest federal department – since November 2019 after the resignation of his predecessor, Kevin McAleenan.

In late August, weeks into the unrest in Portland, Oregon, Trump announced his intention to nominate Wolf to serve as Homeland Security secretary – a surprising maneuver given Trump’s preference to have Cabinet officials serve as acting because, he says, it gives him “more flexibility.” DHS has not had a Senate-confirmed secretary since April 2019.

The nomination came on the heels of a Government Accountability Office report that found the appointments of Wolf and his deputy Cuccinelli were invalid.

While the Senate Homeland Security Committee cleared the way for a Senate confirmation vote in the fall, it did not come for a floor vote, leaving Wolf to continue serving in an acting capacity.

His tenure has repeatedly come up in litigation against the administration’s immigration actions. Wolf’s appointment was notably cited in a challenge against new rules limiting the Deferred Action for Childhood Arrivals program.

In November, a federal judge found Wolf had not been legally serving as acting Homeland Security secretary when he signed rules limiting applications and renewals for DACA, which shields undocumented immigrants who came to the US as children from deportation, and said those rules are now invalid. The program – which Trump pledged to terminate – was later restored.

In a previous attempt to self-correct the succession order, DHS had Gaynor, who is the Senate-confirmed FEMA administrator, temporarily exercise the authority of Homeland Security secretary to try to alleviate concerns over Wolf’s legitimacy as acting chief of the department. Under one interpretation, Gaynor would be the lawfully serving acting secretary based on the Federal Vacancies Reform Act.

According to his FEMA bio, Gaynor, who was confirmed last January, has more than 11 years of experience in emergency management. Under his tenure, the agency juggled natural disasters as well as response to the coronavirus pandemic.

Gaynor told his workforce he will assume the role of acting Homeland Security secretary until January 20, when Biden is inaugurated, according to a message obtained by CNN.

FEMA Region 9 Administrator Bob Fenton will serve as the senior official performing the duties of the FEMA administrator, Gaynor said, until the next administrator is confirmed.

This story has been updated with additional information.