The leniency shown to retired general David Petraeus for passing secrets to his lover shows the “profound double standard” of the Obama administration when it comes to leakers, a lawyer for a State Department contractor convicted of providing Fox News with classified information has said.

Abbe Lowell, who represents Stephen J Kim, has written to the Justice Department urging his client’s immediate release – and denouncing the administration’s hypocrisy.

“The decision to permit General Petraeus to plead guilty to a misdemeanor demonstrates more clearly than ever the profound double standard that applies when prosecuting so-called ‘leakers’ and those accused of disclosing classified information for their own purposes,” Lowell wrote.

“As we said at the time of Mr Kim’s sentencing, lower-level employees like Mr Kim are prosecuted under the Espionage Act because they are easy targets and lack the resources and political connections to fight back. High-level officials (such as General Petraeus and, earlier, Leon Panetta) leak classified information to forward their own agendas (or to impress their mistresses) with virtual impunity,” Lowell wrote in the letter, dated 5 March.

Lowell said in his letter, first reported by the New York Times and the Intercept, that the Justice Department rejected “out of hand” his offer of a misdemeanor charge for mishandling classified information.

Yet earlier this month, Petraeus, the former CIA director and a man whose name has become synonymous with the 2007-08 troop surge in Iraq, pleaded guilty to a misdemeanor charge of providing his biographer and lover Paula Broadwell with notebooks containing classified information, including the names of covert operatives and war strategy, research for a biography. Like Kim, Petraeus, by a mutually agreed statement of facts, lied to his FBI interviewers.

“We know that you can come up with any number of factors (as lawyers are trained to do) to distinguish the two cases. However, that is just an exercise in lawyering. At the bottom line, the activities are the same,” Lowell wrote.

Under Obama and attorney general Eric Holder, the Justice Department has pursued leakers of classified information with greater vigor than all its predecessors combined: eight Espionage Act cases under Obama, compared to three since the law’s 1917 passage.

But its targets are previously unknown men like Thomas Drake, a National Security Agency whistleblower whose finances were ruined in a case resulting in a misdemeanor conviction; Jeffrey Sterling, a CIA officer who told Times reporter James Risen about a botched espionage operation that may have aided the Iranian nuclear program; and John Kiriakou, another CIA officer who confirmed agency torture policies but also passed along the name of an undercover agent.

Left unprosecuted is Panetta, the former CIA director and defense secretary who allowed a producer for the film Zero Dark Thirty into a classified speech that discussed details of the raid to kill Osama bin Laden. Another investigation into the leak of a highly classified US-Israeli cyber operation to sabotage the Iranian nuclear program – ahead of the 2012 election, which permitted Obama to shore up his national security bona fides – has stalled, although retired General James “Hoss” Cartwright, a former vice-chairman of the Joint Chiefs of Staff, is said to be the target.

Among the reasons that investigation has stalled, the Washington Post reported last week, is that Cartwright’s lawyer “might try to put the White House’s relationship with reporters and the use of authorized leaks on display, creating a potentially embarrassing distraction for the administration”.

By freeing Kim, Lowell wrote to the Justice Department, “this uneven and disparate treatment can, in at least one case, be somewhat rectified”.