HALIFAX -- An officer in the Royal Canadian Navy who pleaded guilty to desertion testified Monday that he left his post on a ship after he was subjected to deplorable behaviour that included a colleague urinating on his cabin floor.

Lt. Derek De Jong, 43, told a court martial that while he was wrong to leave his post aboard HMCS Preserver, he was harassed and his commanding officer failed to properly investigate his concerns.

De Jong left the supply vessel on Sept. 17, 2012, while it was docked in Key West, Fla., and he returned to Halifax, where he turned himself in to military police.

He said there were a series of incidents leading up to his desertion that began in late August that year.

On Aug. 20, De Jong had a conflict with another crew member over the handling of alleged misbehaviour by a female subordinate, he told his sentencing hearing.

The next day, a female officer came into his cabin while he was still asleep, pulled down her pants, squatted and urinated on the floor, he said.

De Jong said he reported the incident to the supply officer and the ship's commanding officer but no formal inquiry resulted.

He said a senior officer later joked, "Some men have to pay for a service like that," and a sign was briefly attached to his cabin door that said, "Women's head," a reference to a nautical term for a woman's bathroom.

"I don't think people should have to tolerate this kind of behaviour," De Jong said Monday.

"It's not a norm in Canadian society that we treat each other this way."

He said after the incident he felt he was working in a "toxic" environment, and he heard second-hand that he was no longer welcome in the wardroom among officers and other colleagues.

On the day before he deserted, he advised his superior officers against giving an excessive amount of alcohol to 270 crew members to celebrate the completion of their military operation in the Caribbean, the court martial heard.

"It was enough alcohol to get all of them very, very drunk," he testified.

But he said his advice was ignored and as a result, some sailors became so inebriated that they had to be returned to the ship by local police.

The prosecution said Monday that on Sept. 17, De Jong argued with several other officers and then changed into civilian clothes, packed his bags and told other officers he was returning to Halifax.

De Jong said he regrets his decision and wouldn't repeat it.

"Terrible," he replied when asked by defence lawyer Maj. Sarah Collins how he felt about his actions. "What I did was wrong."

He said he was feeling a high level of stress and a doctor later told him he was suffering from a heart condition related to that.

Capt. Angus Topshee, the commander of Canadian Forces Base Halifax, testified earlier in the day that many officers face difficult work environments but don't desert their posts.

Topshee said he had approved a promotion for De Jong, but had some misgivings.

"I was concerned he takes some things very seriously, perhaps more seriously than he needs to take them," he said.

The court martial also heard testimony from Cmdr. Edward Forward, a senior logistics officer in Halifax, who said that since being reassigned to a land-based training role De Jong has excelled in his work.

Forward said De Jong should remain in the military.

"He is outstanding," he said, referring to De Jong's work training hundreds of people in inventory management software.

The prosecution is scheduled to cross-examine De Jong on Tuesday.

The maximum sentence for desertion under the National Defence Act is life in prison.