For two years, President Donald Trump has waged a campaign to discredit James Comey, the former FBI director who witnessed Trump’s obstruction of justice in the Russia investigation. Now Trump thinks he has an additional weapon. It’s an investigative report on Comey, issued last week by the Justice Department’s inspector general. In a statement on the report’s findings, the White House calls Comey “a proven liar” and claims that because he “shamefully leaked” to the press, America “was forced to endure the baseless politically motivated, two-year witch hunt.”

The White House is misrepresenting the report. The report does say that by sharing memos with people outside the Justice Department—memos in which Comey documented Trump’s obstruction attempts—the former director violated FBI and DOJ policies. But it finds no evidence that Comey lied or broke the law. And if you read the report’s narrative, you’ll get a picture that matches previous assessments of Comey: He’s an honest man who, at worst, occasionally does the right thing the wrong way. (Disclosure: My wife works for the DOJ inspector general. She told me nothing about this report or what was in it.)

Comey isn’t a crook. He’s a cowboy. Sometimes he ignores protocol or the chain of command to do what he thinks is right. In May 2016, he publicly criticized Hillary Clinton for her email practices, despite having concluded that she shouldn’t be prosecuted. Days before the 2016 election, he again bypassed his bosses, telling Congress that he was reopening the Clinton investigation. In January 2017, Comey circumvented acting Attorney General Sally Yates, deciding on his own to send agents to interview then–national security adviser Michael Flynn as part of the Russia investigation.

The DOJ report fits this pattern. It reprimands Comey for taking his memos to the press after Trump fired him in May 2017, rather than reporting Trump’s conduct through internal channels.

“Comey’s own, personal conception of what was necessary,” the report concludes, “was not an appropriate basis for ignoring the policies and agreements governing the use of FBI records.” But the report also paints a more complicated picture. It portrays a man in a difficult position, struggling to do what’s ethical and to protect the integrity of his bureau and his department.

The report doesn’t assess Comey’s behavior apart from the rules he broke. But its narrative, based on written records and interviews with 17 witnesses, shows that it was Trump, not Comey, who persistently broke rules in the Russia investigation. And it was Comey who tried to restore order. When Trump and his then–chief of staff, Reince Priebus, asked Comey for favors or inside information, Comey told them to go through the White House counsel and the attorney general. After Trump kicked Attorney General Jeff Sessions out of the Oval Office so Trump could ask Comey to drop his investigation of Flynn, Comey told Sessions not to leave him alone with the president.

The narrative indicates that Comey, unlike Trump, seldom acted alone. He documented his first conversation with Trump only after FBI colleagues agreed that it should be memorialized. Comey shared and discussed his memos with some of these colleagues. He consulted the FBI’s general counsel as to what he should or shouldn’t say when the president cornered him alone. Each time Trump phoned him to talk about the Russia investigation, Comey reported the conversation to his superiors.

When Comey did act alone, the narrative suggests he was scrupulous. He believed that two of his memos contained classified information, and for that reason, he didn’t take them home or share them with anyone outside the FBI. He redacted additional material from a third memo, just to be safe, before passing it to his attorneys. Trump is correct that Comey leaked: Shortly after the FBI director was fired, he passed one of his memos to a friend and asked that friend to discuss its contents with a New York Times reporter. But Trump is wrong when he claims that Comey leaked classified information. “We found no evidence,” says the report, “that Comey or his attorneys released any of the classified information contained in any of the Memos to members of the media.”

Why would an honest FBI director take memos home and later share one of them with the press? The report doesn’t analyze Comey’s motives, but it lays out a sequence that suggests what happened. Comey tried to go by the book. Then, as Trump sought to corrupt the FBI and the Justice Department, Comey prepared a backup plan. He put some crucial documents beyond the government’s reach, and he found a non-governmental institution—the press—through which he could release information.

When Comey did act alone, the narrative suggests he was scrupulous.

Comey wrote his first memo, about a scheduled briefing with Trump, on his FBI laptop. But his next meeting with the president, on Jan. 27, 2017, was unscheduled and alarming: Trump invited Comey to dinner, one-on-one, and pressed him for personal loyalty. This time, Comey wrote a memo on his personal laptop, printed it out, and locked the document in a personal safe at his house. In interviews with DOJ investigators, Comey later explained that he wrote this second memo because, after the Jan. 27 conversation, he saw that Trump was “fundamentally dishonest” and might lie about their conversation. On Feb. 14, when Trump again tried to corrupt him—this time asking him to drop the Flynn investigation—Comey did the same thing: He wrote a memo on his personal laptop and locked it in his safe.

That’s not what an FBI director is supposed to do. But Comey’s precautions proved to be wise. On May 9, 2017, while Comey was traveling, Trump fired him and ordered the FBI not to let Comey back into the building. This cut off Comey’s access to the memos at his office. The bureau also sent agents to Comey’s house to confiscate all FBI documents and electronic devices. If Comey hadn’t kept secret copies in his own safe he would have been, at that moment, completely stripped of the evidence of what Trump had done to him.

Trump also enlisted Sessions and Deputy Attorney General Rod Rosenstein to cover up his corrupt motives for the firing. Rosenstein, on Trump’s instructions, wrote a memo justifying Comey’s termination. The memo detailed Rosenstein’s objections to Comey, which Trump then adopted as a pretext. Comey, watching this charade, decided he couldn’t count on Rosenstein to protect the FBI. So Comey decided, according to the DOJ report, to tell the Times about his own Feb. 14 memo—the one about Trump asking him to go easy on Flynn—in order to pressure the department to appoint a special counsel.

Once Rosenstein appointed a special counsel Comey trusted, former FBI Director Robert Mueller, Comey went back to working within the system. In June 2017, when Mueller asked for Comey’s copies of his memos, Comey handed them over.

In a way, the DOJ report is poetic justice. It does to Comey exactly what he did to Clinton, publicly detailing his faults and transgressions even though he’s not being charged with a crime. You can argue that he deserves this castigation. But you can’t argue that he’s dishonest. Contrary to the president’s smear campaign, Comey isn’t being reprimanded for lying. He’s being reprimanded for the way he told the truth.