The communication information systems technician then used his government security clearance to help steal operationally sensitive material from a Defence Force unit, the court heard.
It is unclear exactly what was stolen, and details of the unit are suppressed.
Graham also stole tools from contractors working at a Whenuapai Air Force Base and was further charged with drug-related offending.
Counsel for the police Scott McColgan said Judge Pidwell erred in law when assessing the gravity of Graham's offending.
McColgan said Judge Pidwell's Waitakere District Court ruling meant Graham walked away "without even convictions to mark the offending".
Judge Pidwell, when discharging Graham, said it was "a highly unusual case", although the offending was "very serious".
But several mitigating circumstances led to her decision, she said, including Graham's willingness to help police recover the sensitive material.
A police detective also wrote a letter of support for Graham.
"It's pretty unusual to have a policeman writing a letter of support, not for a discharge without conviction, but nonetheless a letter of support," Justice Anne Hinton said.
"There's no dispute that there is serious offending, but also quite serious mitigating factors," she added.
"I agree that it's a pretty extraordinary response to stress."
Trotter said a discharge without conviction for such offending was not normal.
"And ordinarily I'd agree, but this is far from ordinary. This case is quite exceptional," he said.
He said his client was "trained in way to be deceptive" and when he returned to New Zealand his local command structure knew nothing of his overseas operations.
"He reported to a different command structure for his offshore activities," Trotter said.
But, he added, nothing will be hidden from the military as the Defence Force was aware of the court proceedings.
Trotter said whether Graham continued in the military was a matter for the Defence Force.
The intelligence operative, who has lost his security clearance, said in an affidavit that he has a "strong desire" to remain in the Defence Force.
However, he conceded he may still be dishonourably discharged from the Defence Force even without a conviction, the court heard.
Justice Hinton reserved her decision on the police's appeal.
The Defence Force declined to comment while Graham's case was still before the courts.