OTTAWA -- Vice-Admiral Mark Norman is a free man after federal Crown prosecutors stayed the breach-of-trust case against the military's former second-in-command on Wednesday.

The criminal case over alleged leaks of government secrets was expected to play out during the fall federal-election campaign.

"If at any time that a reasonable prospect of conviction does not exist, it is our duty to end the prosecution," prosecutor Barbara Mercier told Judge Heather Perkins-McVey in a hearing at the Ottawa courthouse.

She said Norman's defence team gave the Crown new information in March.

"This new information definitely provided greater context to the conduct of Vice-Admiral Norman and revealed a number of complexities we were not aware of," Mercier said.

After seeing it, she said, the prosecution no longer believed it had a reasonable prospect of convicting Norman.

In theory, staying the proceedings means the case could resume if the Crown gets new information that makes the prosecutors re-think their prospects again, but Mercier made it clear that that's extremely unlikely.

Norman's lead lawyer, Marie Henein, praised the prosecutors' decision, saying they had "acted in the highest traditions of the bar."

"There has not been a day that Vice-Admiral Norman has walked into this court that we did not have the utmost confidence that this court would be impartial," she said.

Perkins-McVey noted the complexity of the case -- that she herself had received a fresh drop of documents just the previous day.

And then it was over. Said the judge to the admiral: "You are free to go."

The stunning move ends one of the most politically charged criminal cases in Canadian history more than two years after it started with Norman's unexpected -- and at the time unexplained --suspension as vice-chief of the defence staff.

It would later emerge that the RCMP were investigating Norman for allegedly leaking government secrets to a Quebec shipyard and a CBC journalist about a $700-million naval contract.

The investigation culminated last year with Norman being charged with breach of trust for allegedly trying to influence cabinet's decision-making around the contract to lease a temporary naval support ship from the shipyard.

Norman, however, had long denied any wrongdoing and his lawyers instead that the case against him was politically motivated after the newly minted Trudeau government decided in November 2015 to review the project.

Mercier said she believes some of Norman's communications were inappropriate but "inappropriate does not mean criminal."

She told the court that politics played no role in the case and nobody pressured the Crown to bring it, or to drop it.

"There was no orchestration of this charge or this case by anyone. There was no interference whatsoever in the (Crown's) decision to commence this prosecution or in our decision to end it today," she said.

The case has haunted the Liberals, with the opposition Conservatives and numerous former military members voicing their support for him. Liberal MP Andrew Leslie, a former lieutenant-general who commanded the army, was on the defence's witness list.

Leslie was even at the Ottawa courthouse to greet Norman on his way in on Wednesday morning. Norman arrived in full uniform and Leslie, who is retired, was in a business suit. The two shared a handshake and a brief embrace.

After the short hearing, in a brief scrum with reporters outside, Mercier repeated herself.

Crown prosecutor Barbara Mercier said outside the courthouse there was "no political interference" in this case and noted it was a "complex legal charge."

"We decided alone, no political interference whatsoever, that we couldn't make the charge," she said.

A few hundred metres away from the Ottawa courthouse, on Parliament Hill, Prime Minister Justin Trudeau echoed her.

"The process involved in a public prosecution like this is entirely independent of my office," Trudeau said, going into a weekly meeting of the Liberal caucus. "We have confidence in the work done by the director of public prosecutions."

The Liberals would eventually go ahead with the contract with Davie Shipbuilding, which was negotiated by the Harper Conservatives but not finalized before the federal election.

But they also launched an internal investigation into who leaked news of the initial decision to review the project. That investigation identified six leaks, after which the matter was turned over to the RCMP.

The RCMP also eventually charged another federal public servant, Matthew Matchett, with breach of trust. That case was still pending on Wednesday.

The Crown's decision to drop the case against Norman follows months of pre-trials motions in which the suspended military officer's lawyers had been fighting for access to thousands of secret government documents.

Those included memos and emails between various senior government officials, including Trudeau and recently departed clerk of the Privy Council Michael Wernick.

Government lawyers had sought to prevent the release of those documents, arguing they were covered by cabinet-secrecy laws, with the ultimate decision being left with the judge, Perkins-McVey.

Wednesday's appearance was scheduled as to be an update on the government's progress in producing those documents for Perkins-McVey to review before the Crown's unexpected decision to stay the charge.

Norman's actual trial was scheduled to begin in mid-August and run through most of this fall's federal election campaign.

Norman was officially shuffled out as the military's second-in-command last June but remains a member of the Canadian Forces. He is currently assigned to a temporary-duty post in defence chief Gen. Jonathan Vance's office.