GAO has referred the matter to the inspector general of the Department of Homeland Security for further review and potential action. The office also urged the inspector general to consider the consequences of actions taken by invalidly appointed officials.

A DHS spokesman said the department plans to issue a formal response shortly.

"We wholeheartedly disagree with the GAO's baseless report," the spokesman said.

The legal opinion has no binding force but is likely to raise extraordinary legal questions and invite lawsuits about the legitimacy of actions taken by Wolf and Cuccinelli, a conservative immigration hard-liner. GAO says it did not review the validity, leaving the question to the inspector general for consideration.

The GAO opinion was issued at the request of House Homeland Security Committee Chairman Bennie Thompson (D-Miss.) and House Oversight Committee Chairwoman Carolyn Maloney (D-N.Y.), who urged the inspector general to "immediately and swiftly review the legality of actions - which span 16 months - taken by these officials." They also called for Wolf to resign his position and revert to his previously Senate-confirmed role as undersecretary for strategy. And they demanded that Cuccinelli resign entirely.

It's not the first time that Cuccinelli has faced questions about the lawfulness of his appointment. A federal judge ruled in March that he was invalidly appointed to his role as acting director of U.S. Citizenship and Immigration Services, a ruling that blocked two policies he had implemented at the time. Trump hasn't nominated Cuccinelli for either of the two top DHS jobs he has held, a prospect likely to meet resistance among Senate Republicans who have clashed with Cuccinelli in the past.

The decision appears to boil down to a procedural error by DHS. The day before she resigned on April 10, 2019, Nielsen sought to amend the order of succession to provide for McAleenan to succeed her. However, GAO found that the department only changed the succession order for vacancies that result when the secretary is unavailable to serve due to a disaster or catastrophe. The order of succession resulting from a resignation remained unchanged, GAO found, and that order did not provide for McAleenan to take over.

Therefore, after Nielsen's resignation, the law required that the director of the Cybersecurity and Infrastructure Security Agency succeed her, GAO found. But instead, President Donald Trump elevated McAleenan, the head of Customs and Border Protection, to the position. McAleenan then altered the order of succession, providing for Wolf and Cuccinelli's path to the top jobs.

DHS attempted to argue that Nielsen had intended to nominate McAleenan as her successor upon resignation and, in a letter to GAO, argued that this intention was clear and legally valid. But GAO said the letter failed to address the "plain language" of the changes that Nielsen made.

"When Secretary Nielsen issued the April Delegation, she only amended Annex A, placing the Commissioner of U.S. Customs and Border Protection as the next position in the order of succession in cases of the Secretary's unavailability to act during a disaster or catastrophic emergency," GAO found.

tag