The highest-ranking U.S. Navy officer convicted so far in a massive bribery scandal was sentenced to almost four years in prison Friday for selling military secrets to an Asian defense contractor in exchange for prostitutes, stays at luxury hotel and other favors.

Capt. Daniel Dusek, the former commander of the USS Bonhomme Richard, an amphibious assault ship, received a 46-month prison sentence and was ordered to pay $100,000 in fines and restitution during a hearing in federal court in San Diego.

Dusek also heard some stern words from District Court Judge Janis Sammartino, who gave him a slightly stiffer sentence than prosecutors had sought.

“It’s truly unimaginable to the court that someone in your position with the United States Navy would sell out based on what was provided to you,” Sammartino said, adding that Dusek’s actions “potentially jeopardized national security.”