Retired general David Petraeus speaks to the media while leaving Trump Tower this week in New York. President-elect Donald Trump and his transition team are in the process of filling Cabinet and other high-level positions. (Spencer Platt/Getty Images)

Donald Trump, on the campaign trail, would occasionally compare the criminal investigation into whether Hillary Clinton mishandled classified information with the case of former CIA director David Petraeus. In Trump’s view, Petraeus, who pleaded guilty to mishandling classified information, was pursued unfairly, while Clinton deserved to be treated more harshly.

“The system is rigged,” Trump tweeted after the FBI recommended that Clinton not be charged. “General Petraeus got in trouble for far less. Very very unfair! As usual, bad judgment.”

That assessment has long irked Clinton supporters and even the FBI — which feels that Petraeus’s case was a clear-cut example of criminal wrongdoing with aggravating factors, while Clinton’s was not. Now, Petraeus is under consideration for a job in Trump’s administration — possibly even as secretary of state, the job Clinton used to hold.

Petraeus and Trump met this week, and Trump wrote on Twitter that he was “very impressed!”

Retired Army general David Petraeus has emerged as a potential pick for secretary of state in the upcoming administration of President-elect Donald Trump. (Bastien Inzaurralde,Osman Malik/The Washington Post)

If nominated to be secretary of state, Petraeus would have to undergo a potentially bruising confirmation hearing that would probably reexamine the lurid case that led to his conviction and dredge up old comparisons to Clinton. His and Clinton’s cases both involve investigations of mishandling of classified information, but under dramatically different circumstances.

Petraeus pleaded guilty last year to a misdemeanor charge of mishandling classified information, admitting that he gave sensitive materials to his former lover and biographer, Paula Broadwell. He was sentenced to two years of probation and fined $100,000. His probation includes several restrictions that could complicate his holding a Cabinet position — for instance, he must have work-related travel approved by the U.S. Probation Office, and he must submit to warrantless searches by his probation officer at any time.

Petraeus’s probation expires in April 2017, and Trump, upon taking office, could commute his sentence. Jeffrey H. Smith, an attorney for Petraeus, said that his client has made frequent international trips in the past 19 months, and all have been approved by the probation office. Smith said it would be “premature and wrong, in my judgment — simply because he admitted to this one mistake and was convicted of a federal misdemeanor — that he cannot serve as secretary of state.”

“From his point of view, he admitted his mistake, he’s paid the price, and the Senate and the country ought to view him in that regard,” Smith said. “He stood up and took his medicine, and given everything he’s done for the country, and given the potential that he could be secretary of state and what he could bring to the table, he wants all that to be considered as a whole.”

Those involved in the Petraeus case at one point contemplated much more serious charges of lying to the FBI and violating a section of the Espionage Act. Officials have said the information contained in the eight notebooks Petraeus gave to Broadwell could have caused grave damage to national security, if disclosed.

The information included war strategies and the identities of covert officers, the officials said. Petraeus also told agents that he had not provided classified information to Broadwell or facilitated her obtaining it, which FBI Director James B. Comey said was a lie.

Smith said Petraeus realized soon after he gave the journals to Broadwell “that was a mistake,” and he asked for them back. He said Broadwell had agreed that she would not use classified material in her book, and none was included. Smith also disputed that Petraeus intentionally misled investigators, saying that Petraeus “had forgotten about the journals” when the FBI asked him whether he gave Broadwell classified information.

At a congressional hearing this year, Comey asserted forcefully that the Petraeus case was worthy of prosecution, while the Clinton case was not. He said the Petraeus case “illustrates importantly the distinction” with the Clinton matter.

“So the question is, do you agree with the claim that General Petraeus, and I quote, ‘got in trouble for far less,’ end of quote? Do you agree with that statement?” Rep. Elijah E. Cummings (D-Md.) asked the FBI director.

“No, it’s the reverse,” Comey said.

“And what do you mean by that?” Cummings said.

“His conduct, to me, illustrates the categories of behavior that mark the prosecutions that are actually brought. Clearly intentional conduct. Knew what he was doing was a violation of the law. Huge amounts of information that — even if you couldn’t prove he knew it — it raises the inference that he did it. An effort to obstruct justice. That combination of things makes it worthy of a prosecution, a misdemeanor prosecution, but a prosecution nonetheless.”

Smith declined to comment on the direct comparison of Petraeus’s case and Clinton’s.

FBI agents investigated Clinton to determine whether classified information was mishandled because of her use of a private server while she was secretary of state. Comey said Clinton and her staffers were “extremely careless” in how they handled sensitive material, and there was “evidence of potential violations of the statutes regarding the handling of classified information.” But Comey said that “no reasonable prosecutor” would actually bring a case against her.

Classified material did traverse Clinton’s private server. Information in 110 emails contained information sensitive enough to be classified at the time it was sent or received, and eight email chains included information properly classified as “top secret,” the highest level of classification, Comey said.

But Comey said agents could find no substantive evidence that Clinton intended to mishandle classified information, that she lied during her interview with agents, or that she made any efforts to obstruct justice. Clinton has said using the private server was a mistake and one she wishes she had not made.

Comey did not fully clear Clinton of wrongdoing. Were an FBI employee to do what she did, Comey said, the employee might face professional consequences, such as a loss of a security clearance, suspension or even termination. But he said he did not feel she should be charged with a crime.

Petraeus — a retired Army general and former CIA director who left the agency amid revelations about his relationship with Broadwell — would need a security clearance to serve as secretary of state. The CIA suspended his security clearance after his conviction and it remains suspended, U.S. officials said. A CIA spokesman declined to comment. Smith said that Petraeus does not hold a security clearance.

A criminal conviction would not automatically preclude Petraeus from obtaining a clearance. He would have to pass a background check that assesses his “strength of character, trustworthiness, honesty, reliability, discretion, and sound judgment, as well as freedom from conflicting allegiances and potential for coercion, and a willingness and ability to abide by regulations governing the use, handling, and protection of classified information,” according to information on the State Department’s website. Whether to grant a clearance is a “discretionary security decision based on judgments by appropriately trained adjudicative personnel,” according to the site.

A State Department official said the department would “not speculate on prospects for that process.”

This story has been updated with comments from Petraeus’s lawyer.

Greg Miller contributed to this report.

For a video, go to wapo.st/clintonpetraeus.