When you focus a policy it has to be for a justifiable reason. In the case of focusing policy on mental illness to control gun violence, the question must be do the mentally ill represent a significantly different risk of gun violence from the general population. This is necessary because of constitutional protections for -all- citizens including the equal protection clause
The answer to whether there is such difference for all classifications of gun violence and all classifications of mentally illness compared to the general population is very decidedly -NO-.
When the question gets parsed into different pieces relative to the type of gun violence the answer for a role of mental illness in a specific type of gun violence is decidedly -YES-. Gun suicides are quite definitively linked to depression and anxiety.
But solitary gun suicides are not generally acts of social violence. Social gun violence is gun violence out in society, it includes things like the use of guns in robberies, road rage incidents, gang wars, terror attacks, that include intimidation and shootings in workplaces, schools, retail businesses and public spaces.
Social gun violence would be defined as gun violence that occurs outside of personal relationships, which are matters of domestic violence. Social violence general also excludes violence of persons held in institutions such as prisons, detention camps, and medical and psychiatric hospitals. Gun violence by the mentally ill in institutions is rare and what occurrence there is is outside consideration of "public" policies. Institutionalized persons with mental disorders are prohibited from firearms.
Broadly speaking social gun violence by the mentally ill is statistically uncommon and does not represent significantly increased risks over the general population, which in addition to non-mentally ill members of society also includes a very large number of perpetrators of criminal intimidation with guns, and smaller numbers of people who commit acts of gun violence during acute acts of anger, persons involved in gang violence, persons engaged in acts of terror/political intimidation/rebellion, and persons seeking vengeance, etc.
The public's concern about mentally ill and guns, as demonstrated by very limited concern about the largest category of gun violence--guns used to intimidate during crimes, and by comparison a hyperbolic concern about the acts of violence, is the role of mental illness in intentional mass gun murders in public places against random persons.
Even in this much narrower slice of gun violence in America the role of mental illness is not as clear as one might think, and doesn't clearly support building policies that focus on persons with mental illness.
Mother Jones constructed a database of such mass murders in the US incorporating publicly available information from the 1980s to 2012. Not all of them included guns, mass murders by car and by airplane were included. In that database, about 38% of the murderers could be linked to evidence of clinical mental illness (caveat: only ~20-25% of people seek clinical help for their mental health problems, although persons with more serious mental illness have a somewhat higher rate of help seeking--probably because their daily activities are more impacted by the disorders). Of the events recorded in the database near 60% of the murderers could be associated with 'some' history of symptoms which could be indicative of the presence of mental illness (caveat: symptoms of mental illness are qualitatively within the range of normal emotions, thinking and behavior, what makes them a disorder is the degree and duration of dysfunction brought about by those symptoms. Moreover, about 60 million Americans have some mental disorder each year, so a very large number of people who reach late adolescence and adulthood have experienced some symptoms of mental illness)
So what we can say is slightly more than half of mass murderers between the early 1980s and 2012 have -some- perceived association with mental disorders, although only about 1/3 of the mass murderers have records that would support that. About 66% of intentional mass gun murders in public places don't have a record of evidence that actually established presence of mental illness at all. And that uncertainty means that policies for reducing this specific type of gun violence can't be directed at any rationally narrowed group of mental disorders. Consequently, denial of civil rights to a class of people is very hard to justify in a way that meets court expectations of equal protection.
In recent years, suicide plus mass murder has been on the increase. Because suicide itself is definitively linked to mental disorders, it's very likely that these events are associated with mental illness. But it's not entirely clear -what- mental illness... depression? adjustment disorders? dramatic personality disorders--paranoid schizophrenia? bipolar disorder? borderline personality? What??
The number of these events is thankfully small, but that small size makes statistical significant association hard to obtain for any particular known mental disorder. And there is no reason at all to believe that the psychiatric industry has yet named -every- mental disorder that occurs. For example, Post Traumatic Embitterment, a disorder described in Germany (that includes what we in the US call going-postal) a disorder with good diagnostic clarity, and a disorder for which effective therapy exists, was intentionally left out of the new release of the APA's Diagnostic Manual, mostly it seems because professional reviewers didn't like the use of the terms 'post traumatic' in the name (they fear it is over-applied and would add confusion to PTSD).
How do legislators justify targeting a class of people who can't be shown to be accurately identified. Well they don't need any psychiatric medicine at all to justify policy. They can use public sentiment, which is to say, cultural bias and perhaps even prejudice against the mentally ill (in 2013 a survey was published that found 90% of Americans thought mentally ill shouldn't be institutionalized, but that same survey found 80+% of Americans didn't want a day care center for the mentally ill in their neighborhood, similar percents of Americans didn't want mentally ill persons as neighbors or on their team at work. In 2013, a national survey found that unemployment among the mentally ill was about 80). And public sentiment currently runs very strongly that mentally ill -ARE- the workable part of the problem of mass gun murders in public places.
What caretakers and advocates for persons with mental disorders and persons with mental disorders fear is further criminalization of mental illness and greater institutionalization of discrimination against persons with mental disorders under the rationale that -even the government finds them too dangerous to be treated as full citizens-.
I'm all for ending mass gun murders. If there were clear justification for identifying specific mentally illnesses as a significant part of the problem I'd be ok with targeting persons with those mental illnesses. But as it stands, even among persons with serious mental disorders just less than 7% per year engage in -any- non-institutional violence, which is just shy of 2 percent above the rate of any violent acts in the general population.
And to be clear, all this long reply is just to address the problem of trying to focus policy against persons with mental illness that have a clearly elevated risk so that any policy/law meets it's constitutional requirements.