Naval officer Lt. Cmdr. Edward C. Lin will serve six years in prison for mishandling classified information in an attempt to impress women.

As part of a plea deal, Lin will only have to serve six years instead of the nine that Judge Cmdr. Robert Monahan sentenced him to Friday, and since he’s already spent 646 days in prison, he effectively has only four years left of confinement, The Virginian-Pilot reports.

He will also be dismissed from the Navy and lose all pay allowance.

Prosecutors wanted 12 years and the defense hoped to bring down the sentence to 1.5 years in prison.

Lin pleaded guilty in May mishandling classified information and not reporting foreign contacts relating to his disclosure of secrets to a Taiwanese woman working for a political party and an undercover female FBI agent. He thought the agent, known as Katherine Wu, was a teacher in the middle of a turbulent marriage and decided to share classified info with her in August and September 2015 to impress her.

After an investigation beginning in January 2014, authorities arrested him in September 2015 as he was on his way to meet a woman in China. The investigation found that Lin did not report ties to Taiwanese naval officers or his relationships with Chinese women. He met one of the women at a massage parlor in Honolulu.

“I get physically ill when I think about the damage I could have caused from my actions,” Lin said Friday.

“I’m exhausted and broken in spirit. The best thing I can do is serve as a cautionary tale to others.”

The end result of the case is somewhat different from what was first reported by media outlets. Rather than being an international spy case, it turns out that Lin was not intentionally handing over secrets to foreign governments.

“While this case didn’t turn out to be related to foreign intelligence — not really a ‘spy’ case — the sentence sends a strong message to the force about taking care to safeguard classified and sensitive information,” Rob Bracknell, a Marine veteran and military lawyer, told USNI News.

“It also invites comparison to other more high profile classified and sensitive information cases in Washington, and it may be fair criticism that senior folks are handled with kid gloves compared to rank and file personnel,” Bracknell added.

While in the Navy, Lin served as department head for one of the most secretive units: Special Projects Squadron Two based in Hawaii.

Follow Jonah Bennett on Twitter

Send tips to jonah@dailycallernewsfoundation.org.

Content created by The Daily Caller News Foundation is available without charge to any eligible news publisher that can provide a large audience. For licensing opportunities of our original content, please contact licensing@dailycallernewsfoundation.org.