A Massachusetts judge sided with three Afghanistan war veterans who filed a lawsuit against the state, after being denied "Welcome Home" bonuses because of their other-than-honorable military discharges.

In a decision handed down Wednesday, Associate Justice Michael Ricciuti ordered the Massachusetts Veterans' Bonus Appeal Board to reconsider rejecting the veterans. Lawyers in the case estimate that beyond their three clients, the decision means that about 4,000 Massachusetts veterans are now eligible for the bonuses.

"Veterans with bad paper discharges are among the most at-risk veterans and yet are often told that they are ineligible for traditional veteran services and programs," said Laurel Fresquez, an attorney who represented the three veterans. "Thanks to this decision and these three veterans, thousands of Massachusetts veterans will finally have a right to some recognition for their honorable service to our country."

The Massachusetts legislature created the Welcome Home Bonus in 2005 for post-9/11 service members. Under the program, people who deployed to Iraq or Afghanistan -- and lived in Massachusetts for a period of least six months before enlisting -- are eligible to apply for a one-time, tax-free $1,000 bonus. The program is run by the state treasury.

Jeffrey Machado, Washington Santos and Herik Espinosa -- three Army veterans named in the lawsuit -- each completed enlistments and re-joined multiple times. They applied for the Welcome Home Bonus and were denied by the treasury and then the Veterans' Bonus Appeal Board, which argued their other-than-honorable discharges from their final enlistments made them ineligible.

Machado, Santos and Espinosa, represented by student attorneys at Harvard Law School's Veterans Legal Clinic, filed a lawsuit in 2017 in Massachusetts Superior Court. In the complaint, they argued the board should take into consideration their prior enlistments, which they completed honorably.

The judge agreed, calling the state's denial "erroneous as a matter of law, arbitrary and capricious." He said the board's decision to deny the benefit disincentivized service members from enlisting multiple times.

"The Bonus Law was designed to reward service to the country," Ricciuti's order reads. "The board's reading would penalize such service for military members who voluntarily remain in combat, a result at odds with the legislature's intent."

In a statement Sunday, Machado, the lead plaintiff, said the decision meant more than the $1,000 - it was a symbolic win for veterans with other-than-honorable discharges.

Those discharges, known as "bad paper," can prevent veterans from receiving federal assistance, such as Department of Veterans Affairs health care, disability payments, education and housing. Some lawmakers and veteran advocates have long argued servicemembers with bad paper were, in many cases, unjustly released from the military because of mental health issues.

The Government Accountability Office released findings in 2017 that the Defense Department separated approximately 92,000 service members for misconduct from 2011 through 2015, and 57,000 of them were diagnosed with post-traumatic stress disorder, traumatic brain injury or other conditions that can change service members' moods and behaviors and lead to disciplinary problems.

Machado deployed to Afghanistan during Operation Enduring Freedom in 2012-13 and immediately re-enlisted. According to the complaint, Machado's service ended in 2014 with an other-than-honorable discharge that was "given out after the wounds of war and the stress of service became too great."

Machado was later diagnosed with PTSD and applied for the Welcome Home Bonus during a particularly tough time, when facing the possibility of homelessness, his lawyers said.

"What really matters to me is that other Massachusetts veterans will be recognized for their honorable service to our country," Machado said in a statement. "It's less about the bonus itself -- it's about what it represents."

Veterans who believe they're now eligible for the bonus can apply for it through the state government website. Dana Montalto, a clinical instructor at the Veterans Legal Clinic, said she hoped the state would reach out to veterans who might be eligible.

"For now, the burden is on these veterans to find out about this decision and apply," Montalto said in a statement.

The Massachusetts decision follows other recent wins for veterans with other-than-honorable discharges.

Congress approved a measure in March that requires the VA to provide veterans with mental health screenings and care, even if they received bad paper. Veterans who served in combat zones or areas of hostilities, worked as drone operators in combat zones or experienced sexual abuse or assault are eligible.

In addition, Connecticut opened its state VA resources in October to veterans who can show their other-than-honorable discharges are linked to PTSD, traumatic brain injury or sexual trauma. It's estimated 800 veterans could benefit from the change.