A man from WA's South West region who allegedly held up a gun shop on Thursday morning has been granted bail but has been detained under the state's Mental Health Act.
The 24-year-old has been charged with armed robbery, unlicensed possession of a firearm and ammunition, and possession of a prohibited weapon.
Police arrested the Cowaramup man on Friday night, following a manhunt lasting more than a day.
He appeared in the Perth Magistrates Court via telephone link on Saturday.
The charges come after he allegedly stole a long-armed rifle and ammunition from the South West Firearms & Gunsmithing store in Busselton while in possession of a handgun.
The prohibited weapon charge relates to an illegal Colt Airsoft replica gun.
The accused has been granted bail but was detained at Busselton Hospital under WA's Mental Health Act.
The court heard it was likely he would be transferred to Bunbury Health Campus or Graylands Hospital.
Under the bail conditions, the accused must report to Busselton Police three times a week after he is released from detention and comply with instructions from his psychiatrist and mental health workers.
He must also reside at his home address in Cowaramup and not go within 50 metres of the South West Firearms & Gunsmithing store.
He is due in the Busselton Magistrates Court on Tuesday.