An Accra Human Rights Court has ordered the release of Charles Antwi, who failed in a move to assassinate President John Mahama, at his church.
The judge in a certiorari order ruled that Antwi, who has been declared mentally unstable after medical examination, should be taken to the Psychiatric Hospital for treatment.
The 36-year-old was slapped with a 10-year jail term last month on his first appearance before a Circuit Court.
But a human rights Lawyer Francis Xavier-Sosu appealed to set aside the sentencing of Antwi.
Antwi was apprehended when a member of the Ringway Gospel Center noticed his nervous and suspicious behaviour during the church service last Sunday.
A policeman and a member of the church escorted Antwi outside quietly in order not to disrupt the service.
A loaded and cocked pistol was found following a search on him.
It was not immediately clear why he had carried the fully loaded gun into the church.
President John Dramani Mahama and his family worship regularly at the Ringway Gospel Center but were not present in church when the incident occurred.