I think a psychotic, not a terrorist.
Also, not my area of law, but I think a history of involuntary commitment to a psychiatric facility is a bar to purchase at a FFL, but not to private sales or possession.
https://www.atf.gov/file/58791/download, possession is a federal offence.