Heroes when they came home in 2009, war veterans Mike Jones and James Sosh dealt with difficult returns to civilian life through bleak hazes of drugs and alcohol.

Both were diagnosed with post-traumatic stress disorder after fighting in Afghanistan and Iraq. Within a year of hanging up their uniforms, each faced felony charges: Jones accused of threatening to kill a friend, Sosh of selling prescription painkillers to feed his pill habit. Jones went into therapy and is engaged to be married. Sosh is in prison, getting divorced.

Jones, 30, who had been an Army Ranger, had the fortune to be arrested in Orange County, Calif., which has a treatment court for veterans that sentences them to counseling rather than cells. Sosh, 26, a former Indiana National Guardsman, was prosecuted in state superior court.

Their diverging fates show how some states’ justice systems struggle to accommodate damaged troops. After more than a decade of war in two theaters, 120 veterans courts operate in 35 states, with 100 in the planning stages, according to the nonprofit Justice for Vets in Alexandria, Va. The first was established in Buffalo in 2008.

“Veterans who have served their country and are not career criminals deserve a therapeutic approach,” said Vance Peterson, a judge with a veterans docket in Spokane County, Wash.“I’m beginning to wonder if all of our courts shouldn’t be therapeutic.”

When troubled soldiers are discharged, they become society’s burden. About 1.2 million veterans are arrested every year, the Justice Department estimates. Many wrestle with substance abuse and mental illness, conditions associated with elevated risks of arrest.

Some veterans courts accept only misdemeanor cases, while others handle felonies. “We don’t take rape, murder or child molesters. Short of that, we’ll look at most cases,” said Orange County Superior Court Judge Wendy Lindley, who runs the Orange County Combat Veterans Court in Santa Ana, Calif.

Robert T. Russell, a Buffalo City Court judge, is credited with creating the first civilian veterans docket. He said he got the idea after seeing how well a Vietnam veteran charged with a petty crime responded to a court employee and a visiting county official who also had served in the military.

The defendant, suffering from mental illness, had barely acknowledged him, Russell said. After the three vets went out for a walk, the man came back and addressed him like a soldier.

“His head was upraised. He stood erect. And he said that he was going to try, and try harder,” the judge said. “That totally amazed me, how he responded to them in a way that tapped into part of his military culture.”