“I had no idea I was eligible for all these different benefits, like housing,” said Wiggins, 43, dressed in a khaki-colored jumpsuit as he sat in a room at the Middlesex House of Correction. “I think after I got home I just didn’t know where to look, or it seemed like too much of a hassle.”

Now, 21 years after leaving the Navy, Wiggins is benefiting from a new deployment of services and resources to veterans behind bars.

“We’re placing a greater focus on veterans,” said Middlesex Sheriff Peter J. Koutoujian. “These are people who, in many cases, have been ignored by society since they returned from their service. We owe them a lot more than what they’ve been getting.”

And after more than a decade fighting two wars, many younger veterans end up in prison with post-traumatic stress disorder and other mental health issues, Koutoujian said.

“They’re still struggling with the horrors they’ve seen,” Koutoujian said. “People don’t seek to come here. This is a failure for them. They want to get out of here healthy and strong.”

The agreement allows for the names of inmates at the Middlesex House of Correction — and those awaiting trial at the Middlesex Jail in Cambridge — to be matched with a veterans database maintained by the US Department of Defense.

Most sheriff’s departments in Massachusetts now rely on inmates or detainees to identify themselves as veterans at the time of their booking. Access to the federal database will allow for a more accurate count of incarcerated veterans.

Since July, 68 veterans have been identified in Middlesex facilities, compared with just 19 before the program was launched. The program will soon also be offered at Norfolk House of Correction in Dedham.

The VA signed a separate data-sharing agreement in July with the state Department of Correction
. As of October, 838 veterans were imprisoned in 19 state facilities, Casey said.

“As we build this program, we’re really building our capacity to help veterans,” he added.

In Middlesex, a team of four counselors make weekly visits to the correctional facilities. Two counselors are from the state Department of Veterans Services, and two are from the VA. They talk with inmates about housing, education, and financial and medical benefits available for them upon their release.

“Veterans, in general, are reluctant to ask for help,” said Coleman Nee, the state’s veterans services secretary.
“They’re used to providing help and services, not consuming them. . . . We obviously want people to be accountable for their actions, but ultimately, we want them to make sure that when they’re released, they have the services they need to get to a better place in life.”

By early next year, veterans will get additonal help online.

A secure computer network allows veterans to interview for post-jail services, such as a spot in a residential treatment program.

An avatar-based website will allow veterans to answer questions from a cartoon-like figure about their mental and physical health. A copy of the avatar’s response will be available to counselors.

The services complement long-existing efforts to help veterans serving time in Billerica.

Ed Dion, a Vietnam War veteran, has been working with veterans since starting as a teacher at the facility 15 years ago.

“War is difficult,” said Dion, who lives in Swampscott. “When we [Vietnam veterans] came home, no one did anything for us. I wanted to do what I could to help [inmates] here get back on track.”

In the last year, veterans incarcerated at Middlesex facilities have included a World War II veteran convicted of domestic violence, and Iraq and Afghanistan veterans sentenced for operating under the influence of alcohol.

In May, Wiggins, who most recently lived in Wareham, began serving a two-year sentence in Billerica after a larceny conviction.

While working as a food service manager in Waltham, he stole nearly $30,000
to feed an opiate addiction that started when he became addicted to painkillers after back surgery, Wiggins said.

“I was stealing money from my employer to feed my addiction,” said Wiggins. “When you are addicted to something, especially narcotics, you will do whatever you have to do to get whatever you need. You’re not thinking about the consequences until they actually hit.”

In jail, Wiggins got sober, and he now leads weekly Narcotics Anonymous and Alcoholics Anonymous meetings, he said.

Each day, he mops and cleans his cell-block area and hallways. He has also bonded with fellow veterans.

“You can actually gain a lot of knowledge from each other, when six or seven of you sit around and talk,” Wiggins said.

He recently persuaded a reluctant Army veteran to tag along to a meeting.

“He didn’t want to come, but I said, ‘What do you have to lose?’ You’re not going anyplace. You’ll be out of your cell for an hour or two,’” Wiggins recalled.

The group meetings, and individual chats with Dion, have become part of the rhythm of life in prison, Wiggins said.

“It’s funny; being in jail you learn to look forward to something,” Wiggins said. “We have canteen on Thursday. I know I’ll talk to my mother on Sunday.”