A new national report shows that Virginia has cut funding for mental health programs by 9 percent since 2007, the 17th-largest such spending reduction in the country.

According to figures compiled by the National Alliance for Mental Illness, Virginia slashed $38.6 million from programs that help the mentally ill between fiscal 2007 and fiscal 2011, as the state sought to deal with the affects of the economic downturn that resulted in plummeting tax revenues.

Over that time, the number of people served in state hospitals dipped from 5,697 to 5,309, though the number aided by local community service boards rose from almost 122,000 to almost 163,400.

The study showed that over the past four years, Virginia cut more deeply than Maryland, which trimmed 4 percent from mental health programs. It reduced spending far less drastically than the District, however, which cut 19 percent from its mental health program budget — or $44 million.

The group noted that two-thirds of states have cut mental health funding amid the downturn, even as mental health needs have been rising. In a statement, NAMI Virginia Executive Director Mira Signer said those cuts have been short-sighted, noting that if untreated, the mentally ill often end up in emergency rooms or in the criminal justice system, where their care costs taxpayers more.

However, she praised Virginia Gov. Bob Mc­Don­nell (R) and the General Assembly for restoring some mental health funding this year, as the legislature for the first time in several years faced better-than-expected tax collections.

“Their actions mean that communities and families will have more resources at their disposal to assist people in times of need and to avoid devastating crises,” she said.