Washington (AFP) - An American soldier who abandoned his unit to join the French Foreign Legion has been convicted of desertion and sentenced by the US military to four years in prison, the New York Times reported Tuesday. 

Second Lieutenant Lawrence Franks told a military court that he had been struggling with suicidal urges and that the arduous regimen of the legion was the only way to escape his crippling depression, the Times wrote. 

"I needed to be wet and cold and hungry," he told the paper, before he was sentenced Monday. " I needed the grueling life I could only find in a place like the legion." 

Franks went missing from his unit at Fort Drum in New York state in 2009 and flew to Paris, signing up with the French Foreign Legion on a five-year contract under an assumed name, Christopher Flaherty. 

He was deployed to the Central African Republic and Djibouti, and served as the personal security guard for five months for General Laurent Kolodziej, who oversaw the French military's operations in Mali against Al-Qaeda-linked Islamist militants. 

"He is a man I will never forget and by whom I will always stand," Kolodziej said in testimony by video-link at the court-martial proceedings. 

"He is more than a born soldier, he is a born gentleman.  I would like to have 10 men like that in my team, and I would be the happiest of generals." 

When he finished his five-year stint in the legion in March 2014, he turned himself in to the US Army in Germany, the Times reported. 

Franks had been a graduate of the prestigious US military academy at West Point, where he finished in the top 12 percent of his class. 

But he had bouts of depression that grew worse after graduated from the academy.  He was sent to Fort Drum and assigned charge of a medical platoon. 

Military prosecutors accused him of shirking his duty and causing problems for his fellow troops, saying he deserted intentionally before his unit was due to deploy to Afghanistan. 

Franks testified that he could not wait as his unit was not due to deploy for nearly a year. 

"I feel really bad for the pain I put on my family, the disruption to my unit," he said. " But I don't regret what I did -- any of it, good or bad -- because it saved my life."