Eric Holder was U.S. attorney general from 2009 until 2015. (James Lawler Duggan/Reuters)

Former U.S. attorney general Eric Holder appeared on “Real Time with Bill Maher” on Friday night to compare the behavior of his old boss, Barack Obama, with the scandals of President Trump.

Holder prefers the former president.

In a friendly interview with his fellow Trump critic, Maher brought up the revelation that dozens of White House aides — including Trump’s son-in-law, Jared Kushner — still lacked permanent security clearances after more than a year.

“Did you have anybody in the White House who didn’t have security clearance?” Maher asked Holder, who was Obama’s attorney general for most of his presidency.

“Certainly not at this stage,” Holder said, using his own experience as an example. “I’ve been through three or four background checks to get [top-level] security clearance. … The last one probably took six to eight weeks to do. Simple as that.”

Trump — who has openly criticized and sought to reverse policies of Obama’s administration — praised Holder in a New York Times interview late last year. The president lamented that his own attorney general, Jeff Sessions, had left him exposed to a federal investigation into links between his 2016 campaign and Russia’s interference in the election.

“Holder protected President Obama. Totally protected him,” Trump told the Times in December. “And I have great respect for that.”

“Did you protect President Obama?” Maher asked Holder on Friday.

The former attorney general drew applause from the studio audience when he quipped: “The difference between me and Jeff Sessions is, I had a president I did not have to protect.”

Holder had used nearly the same line in an interview with The Washington Post last month. Maher didn’t challenge him to defend it, but some critics have accused Holder of protecting Obama for years.

In 2012, Holder became the first sitting attorney general to be held in contempt of Congress — in a 255-to-67 vote — for refusing to turn over documents related to a botched gun-running investigation by the Bureau of Alcohol, Tobacco, Firearms and Explosives.

The same month, Holder refused to appoint a special counsel to investigate accusations that people close to Obama were leaking classified information.

“Holder is a lightning rod for anger in the administration — viewed by his supporters as a symbol of Obama’s ambitions and by his enemies as a symbol of the president’s aloofness and overreach,” David A. Fahrenthold and Sari Horwitz wrote for The Post at the time.

Whether it was due to Holder’s interference, no Republican-led investigation of Obama had amounted to much by the time Holder left the White House in 2015 — or by the time Obama finished his presidency.

The investigation into Russian interference in the 2016 elections, in contrast, has grown wider and closer to the president each passing month. Special counsel Robert S. Mueller III has secured an indictment against Trump’s former campaign chairman and guilty pleas from several people with ties to the campaign. Though none of Mueller’s accusations, so far, has shown direct ties between the Russians and the Trump campaign, it is broadly speculated that the special counsel is lining up an obstruction-of-justice case against the president.

Holder said Mueller has probably already prepared such a case. “I’ve known Bob Mueller for 20 or 30 years,” he told Maher. “My guess is, he’s just trying to make the case as good as he possibly can.”

Holder said much the same thing in his February interview with The Post. Though Maher didn’t bring it up on Friday, Holder has also raised the possibility that he might run for president in 2020.

An earlier version of this story referred to the contempt vote against Holder as “bipartisan.” To clarify: It was largely a party line vote, though 17 Democrats voted for contempt and two Republicans voted against it. Most Democrats abstained in protest.

Read more:

Eric Holder on Russia investigation, gerrymandering concerns and possible 2020 presidential bid