In 2016, the White House Transition Project published a memo for the next White House counsel — whoever that might be — with an explanation of the basics of the job, and advice from counsels in previous administrations. The bottom line was a piece of advice given by Bernard Nussbaum, a White House counsel under Bill Clinton: “Small (and not so small) policy and political problems grow into legal problems. It was my job to make sure that these political and policy brushfires didn’t become conflagrations.”

President Donald Trump’s White House counsel, Donald McGahn, isn’t known for that sort of caution. He’s assertive and combative; as an election law expert, he had a reputation (according to a New York Times profile written when he was appointed) “as a man who knew every wrinkle in the law in fighting to keep his clients out of trouble.”

For the past two years, McGahn’s client has been Donald Trump. McGahn supported Trump early and vocally — two things the president values very highly. It’s not surprising that he was rewarded for his service as Trump’s main campaign lawyer by being appointed White House counsel, or that he’s backed the president’s more aggressive assertions when it comes to ethics laws (that the president “can’t have a conflict of interest” because the office is exempt from federal laws on the subject, for example).

But as White House counsel, McGahn has failed to keep Trump out of trouble. In less than a month, the Trump administration has already allowed two “brushfires” to grow into legal conflagrations.

Its executive order temporarily banning all people from seven majority-Muslim countries and nearly all refugees has been put on hold by federal judges, after a disastrous rollout, inconsistent interpretation, and an attempted post hoc fix to exempt green card holders from the order.

And now its national security adviser, Michael Flynn, has resigned over revelations that he discussed sanctions with Russian Ambassador Sergey Kislyak while President Barack Obama was still in office, directly contradicting what he’d told Vice President Mike Pence. The FBI is pursuing a criminal probe into Flynn’s dealings with the Russian envoy.

McGahn isn’t the author of either of these fiascos. But his role in the administration was supposed to be to make sure they stayed political problems, not legal ones — or at least to see the legal problems coming, and get the rest of the administration to take them seriously.

It doesn’t seem like he managed to do either.

Don McGahn knew Flynn had lied. What did he do with that information?

The scandal over Flynn’s calls with Russia is a classic case of “what did they know and when did they know it.” And the only person in the Trump White House that we know, for sure, was aware that Flynn had lied is Don McGahn.

In early January, FBI agents, monitoring Kislyak’s communications, discovered the Flynn call. Their secret report on the topic reached senior officials at the Justice Department, including acting Attorney General Sally Q. Yates. When news of the call broke in mid-January, senior Trump team officials — including Vice President-elect Mike Pence — publicly denied that Flynn had discussed sanctions with the Russian ambassador. But it wasn’t until Trump had been inaugurated as the 45th president (and press secretary Sean Spicer had again denied the Flynn allegations during his first press briefing) that the DOJ decided to tell the Trump administration what they knew about Flynn.

Sometime between January 23 and January 31, Yates and a “senior career national security official” talked to White House counsel McGahn about Flynn. Yates told McGahn, according to the Washington Post, that “she believed Michael Flynn had misled senior administration officials about the nature of his communications with the Russian ambassador to the United States, and warned that the national security adviser was potentially vulnerable to Russian blackmail.”

As the Post article then says, “It is unclear what the White House counsel, Donald McGahn, did with the information.”

Press secretary Spicer said at a briefing Tuesday that McGahn immediately told other members of the administration, and conducted an investigation in which he concluded (along with the president) that while Flynn hadn’t broken the law, there was “an issue of trust” that required Flynn to resign. White House counsels typically aren’t asked to rule on “issues of trust,” but that is the sort of caution that a White House counsel would be expected to demonstrate.

The problem is that it’s not clear Spicer’s account is true. In addition to contradicting other statements from administration officials (which said that Trump hadn’t asked Flynn to resign), it doesn’t reflect the fact that Flynn’s job appeared secure until the public found out about the true nature of the Kislyak call.

And even then, it took several days — and the revelation that the White House, via McGahn, had already known the truth about Flynn — for Flynn to be pushed out of his job.

It’s likely that McGahn did, in fact, tell senior officials what Yates told him. But contra Spicer, it doesn’t appear that it changed anything: Trump stuck with Flynn, a loyalist who’d won a place in his inner circle by endorsing Trump’s national security bona fides during the election and brutally hammering Hillary Clinton.

McGahn couldn’t have fired Flynn himself, or demanded that Trump fire him. But he was the person in the White House who knew, thanks to Sally Yates, that what had so far been a political problem could turn into a serious legal one — that, despite what Pence and other administration officials had said, Flynn could be in serious trouble with the FBI.

It was his job to alert the rest of the administration to the scale of the coming conflagration. And whatever he did wasn’t sufficient to get the administration to actually address the problem, before it burst into flames in full public view.

McGahn could have limited the chaos of Trump’s refugee ban rollout — instead, he contributed to it

The Trump administration really shouldn’t have been blindsided by the Flynn scandal — this is the second time that they’ve allowed a political problem to become a legal one. The first was Trump’s January 27 executive order on refugees and visas.

McGahn didn’t write the executive order — it’s been widely reported that chief strategist Steve Bannon and senior adviser Stephen Miller were the brain trust behind it, as well as other orders from Trump’s first weeks. But it is the role of the White House counsel to review orders before they’re signed. And furthermore, as former counsel Gregory Craig (who served under Obama) told the White House Transition Project, the White House counsel ought to serve as a traffic cop before an executive order gets signed, so that everyone who might be involved in its implementation understands what’s coming:

Talk to your political stakeholders on the Hill. There are interest groups that care, if you can talk to them. If you have a chance to talk to the people that are in the departments and the bureaucracies, do that, so that when the executive order comes out, there’s going to be a minimum of surprise.

Literally none of those things happened. The relevant Cabinet departments were barely briefed on the order before it was signed. Field agents whose job it was to enforce the order were given little or no training. Congressional offices weren’t briefed on it — although some congressional staff had been secretly tasked to help draft the order, and made to sign a nondisclosure agreement to keep them from telling their bosses.

The “surprises” themselves would have just been a policy brushfire — except that a legal dispute opened up within the administration itself.

Homeland Security Department lawyers, trying to interpret the order several hours after Trump signed it, decided that the order should not apply to green card holders currently in the US. But they were overruled by Bannon and Miller in the White House, who claimed it should apply to green card holders. White House officials gave inconsistent statements; by the end of the weekend, DHS Secretary John Kelly had ordered agents to consider green cards a “dispositive” factor in giving people waivers to enter the US.

The apparent inclusion of at least some green card holders made it a lot easier to challenge the executive order in court — and made federal judges a lot more likely to agree that the Trump administration had overreached. It’s another problem that McGahn either failed to see coming or failed to get anyone else to take seriously. And his ultimate attempt to solve the problem only made it worse.

Instead of asking President Trump to sign a new executive order that made the green card question clearer, McGahn issued a memo from the White House counsel’s office labeled “Authoritative Guidance” to the relevant Cabinet departments: “I now clarify that Sections 3(c) and 3(e) do not apply to such individuals.”

Suffice to say that federal courts are less than convinced that “authoritative guidance” is something the White House counsel’s office has the legal authority to provide.

In the decision by a Ninth Circuit Court of Appeals panel Thursday, upholding a lower court’s injunction against the executive order, the judges all but mocked McGahn’s memo:

The Government has offered no authority establishing that the White House counsel is empowered to issue an amended order superseding the Executive Order signed by the President and now challenged by the States, and that proposition seems unlikely. Nor has the Government established that the White House counsel’s interpretation of the Executive Order is binding on all executive branch officials responsible for enforcing the Executive Order. The White House counsel is not the President, and he is not known to be in the chain of command for any of the Executive Departments.

Trump prizes loyalty — but he also wants a fall guy

According to reports from Politico and others, President Trump is extremely displeased with the rollout of the immigration order — and looking for heads to roll. “I think he’d like to do it now,” one source said to Politico about a staff shake-up, “but he knows it’s too soon.”

That was before the news broke about Flynn’s calls with Kislyak. But now that Flynn has resigned, whether it’s “too soon” for personnel changes in the administration is kind of a moot point.

McGahn has this job because he was an early and loyal Trump ally, and Trump prizes loyalty above nearly everything else. As long as that’s the case, McGahn’s job is safe. But if Trump is upset about the rollout of the immigration order, and about the embarrassment his administration suffered over Flynn, then he should give some thought to the person whose job it is to see those potential disasters coming, and to get the White House to care about containing them. McGahn didn’t start the fires. But under his counsel, the White House is sitting by while they burn.