GILBERT, Ariz. (AP) — An armed man fatally shot by Gilbert police after he allegedly threatened them during an encounter outside his home was a detention officer with the Maricopa County Sheriff's Office.

Sheriff's officials say Joshua Kinnard had been with MCSO for six years and was assigned to inmate medical services.

The 37-year-old Kinnard was on approved medical leave at the time of Monday night's shooting.

Gilbert police say officers went to the home because a caller said Kinnard wasn't feeling well and was acting erratically.

Police say officers spent about 20 minutes trying to calm Kinnard and get him some assistance but Kinnard refused aid.

The officers then left the home and were talking with another resident in front of the house when Kinnard got a gun and reportedly threatened the officers.