When a court:
(1) commits a person under this chapter due to mental illness, developmental disability, or chemical dependency, or as a person who has a mental illness and is dangerous to the public;
(2) determines in a criminal case that a person is incompetent to stand trial or not guilty by reason of mental illness; or
(3) restores a person's ability to possess a firearm under section 609.165, subdivision 1d , or 624.713, subdivision 4 ,
the court shall ensure that this information is electronically transmitted within three business days to the National Instant Criminal Background Check System.