But Judge Patrick Curran said Delisle will serve 18 years and five months behind bars because of time he has already served.
Delisle, 41, was also fined over $111,000, equal to what investigators say he received from the Russians. He has 20 years to pay.
As his children watched in the courtroom, one daughter's eyes welled up with tears as the judge delivered the sentence, reported the CBC's Stephen Puddicombe.
Delisle is the first person to be sentenced under Canada's Security of Information Act.
He pleaded guilty last October to one count of breach of trust and two charges of passing information to a foreign entity that could harm Canada's interest.
A "big chunk of the rest of your life" will be spent paying for the crime, Curran told Delisle.
He said Delisle was aware that Canada safeguarded secret information. He also said Delisle knew he shouldn't leak that information but "coldly and rationally" did so anyway,
Curran went on to say that even if the amount of damage Delisle caused is speculation, the fact that he passed information at all is a serious crime.
"Society is justifiably outraged at the betrayal," said Curran.
Showing no emotion, Delisle sat quietly with his chin rested on his folded hands as he listened to the judge outline his spying and betrayal to the court, reported the CBC's Rob Gordon.
When the sentencing was over, Delisle pulled up his red and blue hoodie, which he's worn to every court appearance, and left.
The Crown had sought a prison sentence of at least 20 years, while the defence asked for nine to 10 years.
Delisle's lawyer, Mike Taylor, said he was surprised by Friday's sentence.
"I just thought considering all the factors that were brought out in court, that the sentence would be somewhat less than what the Crown was asking for. It's as simple as that. They were asking for what I consider a very high number," he said.
"I can't say I'm completely caught off guard, but I was hoping for something less."
The Crown prosecutor said she is extremely happy getting almost exactly what she wanted.
Lyne Decarie said it is all about deterrence and this sentence sends a clear message.
The story began when Delisle walked into the Russian Embassy in Ottawa wearing a red ball cap and civilian clothes. He flashed his Canadian military identification and asked to meet with someone from GRU, Russia's military intelligence agency.
Delisle was posted to the security unit HMCS Trinity, an intelligence facility at the naval dockyard in Halifax. It tracks vessels entering and exiting Canadian waters via satellites, drones and underwater devices.
There, he had access to Stone Ghost, an allied computer system. Delisle spied on top-secret NATO information for four years.
"Nothing in his past life made him stand out as a potential traitor," said Curran.
Review of procedure
Canada's head of defence said Delisle failed all Canadians and violated the trust of Canada's partners, his colleagues and the entire Armed Forces.
Gen. Tom Lawson said he is conducting a full review of security procedures.
"We are actively pursuing measures to improve and enhance all facets of our security procedures," he said.
The Department of National Defence said it has to complete its administrative review before it can strip Delisle of his rank.
Until then he is on full pay.Suggest a correction