President Trump suggested Thursday that the United States can tackle its gun violence problem in part by building more psychiatric institutions and reopening facilities that were shuttered decades ago.

Trump offered the suggestion in an exchange with reporters in Morristown, N.J., shortly before taking off for a campaign rally in New Hampshire. He said it was a “terrible thing for our country” that people with mental illness were “just allowed to go onto the streets” after some psychiatric hospitals were closed.

“We’re looking at the whole gun situation,” Trump said in response to a question about the gun control debate. “I do want people to remember the words ‘mental illness.’ These people are mentally ill. . . . I think we have to start building institutions again because, you know, if you look at the ’60s and ’70s, so many of these institutions were closed.”

“A lot of our conversation has to do with the fact that we have to open up institutions; we can’t let these people be on the streets,” he added.

Many psychiatric institutions were closed beginning in the 1950s amid reports of inhumane treatment, patient-abuse scandals, changing attitudes toward mental health care and the development of drugs to treat mental illness.

While Trump on Thursday revived the debate over whether to isolate the mentally ill in long-term care facilities, Democrats have argued in recent weeks that, by repeatedly blaming mental illness for gun violence, Trump is stigmatizing those with schizophrenia, bipolar disorder, severe depression or other serious conditions.

Many have noted that the El Paso shooting is being investigated as a case of domestic terrorism, as the gunman is believed to have posted an anti-immigrant declaration online just before the attack.

“White supremacy is not a mental illness, and guns are a tool that white supremacists use to fulfill their hate,” Sen. Cory Booker (D-N.J.), who is running for president, tweeted earlier this month.

In the wake of the El Paso and Dayton, Ohio, mass shootings, Trump has called for strengthening background checks for gun buyers and advocated for “red flag” laws that make it easier for authorities to confiscate weapons from those deemed to be a danger to themselves and others.

But his comments in recent days — including his focus on mental illness — have prompted some speculation that he may be walking back his support for tighter gun-control measures.

Earlier this year, Trump threatened to veto two bills passed by the Democratic-led House that aimed to strengthen background checks, saying they did not adequately protect the Second Amendment rights of gun owners.

On Thursday, Trump declined to say whether he supports universal background checks. He said Republicans agree “pretty much uniformly” that they “don’t want to have insane people, dangerous people, really bad people having guns.”

The president also appeared to preemptively blame Democrats for any failure to pass gun-control legislation when the Senate returns next month.

“Well, I’m afraid that if we came up with a good bill, I think the Democrats then might up it and then do things that can’t be done and that the public wouldn’t want done,” Trump said. “I hope that wouldn’t happen, but that’s happened in the past. You understand that.”

John Wagner and Paige Winfield Cunningham contributed to this report.