He said police found no drugs in Winsor's Grey Lynn apartment when they executed a search warrant earlier this week.
"The reality is that if he remains in custody, he will probably have to wait a year for trial."
Judge Joyce said that could be fatal.
Mr Holland said the pistol was actually a ramset gun which had been modified to shoot "rodents".
Judge Joyce said they must be "large rodents".
The police charge sheet said the ramset gun was able to fire bullets.
Police opposed the bail application because they had concerns Winsor would offend while on bail.
But Judge Joyce said he would grant Winsor bail so he could take part in the treatment programme.
He said he had received a letter from Auckland Clinical Studies which said Winsor had gone through a screening process for the trial which is due to start today.
Winsor had a "significant chance" of being cured from the disease, said Judge Joyce.
Winsor will next reappear in court later this month.