ATF rules forbid anyone who has been involuntarily committed to a mental institution from possessing a firearm. A 5150 hold is not quite the same thing, but someone could make a case that you fall under that exclusion. If you can't lawfully possess a firearm, you can't be a law enforcement officer.