A top Army commander on Monday ordered that Sgt. Bowe Bergdahl face a court-martial on charges of desertion and endangering troops stemming from his decision to leave his outpost in 2009, a move that prompted a huge manhunt in the wilds of eastern Afghanistan and landed him in nearly five years of harsh Taliban captivity.

The decision by Gen. Robert B. Abrams, head of Army Forces Command at Fort Bragg, N.C., means that Sergeant Bergdahl, 29, faces a possible life sentence. That is a far more serious penalty than had been recommended by the Army’s investigating officer, who testified at the sergeant’s preliminary hearing in September that prison would be “inappropriate.”

According to Sergeant Bergdahl’s defense lawyers, the Army lawyer who presided over the preliminary hearing also recommended that he face neither jail time nor a punitive discharge and that he go before an intermediate tribunal known as a “special court-martial,” where the most severe penalty possible would be a year of confinement.

Monday’s decision rejecting that recommendation means that Sergeant Bergdahl now faces a maximum five-year penalty if ultimately convicted by a military jury of desertion, as well as potential life imprisonment on the more serious charge of misbehavior before the enemy, which in this case means endangering the troops who were sent to search for him after he disappeared.