A Canadian naval officer pleaded guilty to leaking military-communications intelligence, a surprise ending to a spy scandal that embarrassed Canada's military and briefly caused a rift between Canadian and U.S. security officials.

Sub-Lt. Jeffrey Delisle pleaded guilty on Wednesday to one count each of communicating safeguarded information and attempting to communicate safeguarded information and one of breach of trust, public prosecutors said.

The...