GATINEAU, Que. -- Canada's top special forces soldier has been fined $2,000 after accidentally firing his weapon near another military officer last year.

A military judge handed down the punishment after Maj.-Gen. Mike Rouleau pleaded guilty at a court martial on Tuesday to one count of conduct to the prejudice of good order and discipline.

The case stemmed from an incident in northern Iraq last December, where 170 Canadian special forces are training Kurdish forces in the fight against the Islamic State of Iraq and the Levant.

According to a statement of facts read during the court martial, Rouleau and another officer were getting ready to visit a forward operating base after presenting several soldiers with medals when his rifle fired one round. The bullet hit the ground less than two feet from the other officer.

One of his subordinates had earlier warned Rouleau that the rifle was loaded, according to the statement. After the shot was fired, Rouleau expressed surprise, saying: "I can't believe that just happened."

A few minutes later, according to the statement, Rouleau told several soldiers: "Fellas, that was totally me, and I'll be sure to present myself to the CDS," referring to chief of the defence staff Gen. Jonathan Vance.

During the trial, prosecutor Maj. Chavi Walsh said Rouleau could have faced a maximum punishment of dismissal from the military with disgrace. He noted Rouleau, as a senior commander, had a responsibility to act as an example for his troops and hold himself to a higher standard.

But Walsh said he and Rouleau's defence lawyer, Maj. Luc Boutin, had agreed that a $2,000 fine sent a sufficiently strong message about the proper handling of weapons. It was also in line with the punishments handed out in a number of similar cases, he said.

During sentencing, Judge Lt.-Col. Louis-Vincent d'Auteuil said Rouleau's experience and position as a senior officer were aggravating factors. But he also said Rouleau was quick to report the incident and that he looked favourably upon Rouleau's reputation as a leader as well as his unblemished record.

In a statement released Tuesday evening, Vance said the ruling "not only reaffirms the value in having a strong justice system, but also the requirement to hold everyone in the Canadian Armed Forces accountable for their actions."

He said he was impressed with Rouleau's professionalism throughout the process and he said he has "complete confidence in his ability to serve as commander of our special forces."

Rouleau said little during the court martial, speaking only when required to respond to the judge. But in a statement to reporters afterward, he said he accepted the punishment and was happy to put the incident behind him.

"I accepted responsibility for this from the day it happened, and so I'm very pleased with the result," he said. "I'm proud to belong to a profession of arms where the accountability of the generals is the same as they are for the privates and the corporals. That's the way it should be."

Rouleau said his only regret was that his actions had taken the spotlight away from his troops.

The special forces commander is the latest senior officer to be fined for accidentally firing his weapon.

Brig.-Gen. Daniel Menard, for example, was fined $3,500 after firing two bullets in Afghanistan while he was commander of Canadian troops there in 2010.

Another officer, Lt.-Col. Gilles Fortin, was also fined after accidentally firing a round from his pistol in the Kabul International Airport in 2012. Fortin had to pay $1,500.

Rouleau's three-hour court martial heard from one witness. Chief Warrant Officer Dan Legault, who was with Rouleau in Iraq when the rifle discharged, said special forces troops receive more training with their weapons than average soldiers and take great pride in knowing how to use them safely.

"We take it even a step higher in terms of weapons safety, weapons handling, just to reflect what we achieve," Legault said. But he also spoke highly of his commanding officer, calling Rouleau "the utmost talented operator that I had the privilege to serve with."

A 28-year veteran of the Canadian Forces, Rouleau has commanded the Canadian Special Operations Forces Command since February 2014.