A cabdriver accused of shooting and critically wounding an Alexandria police officer has been declared competent to stand trial after months of psychological treatment in a state mental hospital.

Kashif Bashir, who was charged with attempted capital murder of a police officer in the Feb. 27 shooting of Officer Peter Laboy, will now be moved from Central State Hospital in Petersburg, Va., to jail to await trial. During a hearing in Alexandria Circuit Court Thursday, prosecutors and a defense attorney said doctors had decided Bashir, 28, could assist in his own defense and understand the proceedings in his case, and Judge James C. Clark declared him competent to stand trial.

The outcome was somewhat surprising, given that only last year, Bashir’s attorney wrote that her client thought people involved in the case had shape-shifted and communicated with him telepathically. Prosecutors agreed then that Bashir was not competent to stand trial, and Clark in July entered an order declaring him so.

What changed specifically remains unclear. A report about Bashir’s mental health was still sealed Thursday, and prosecutors and his defense attorney declined to comment. Emily Beckman, the defense attorney, said in court that while she agreed Bashir was competent, she was concerned that his medication regimen had “not been stable for that long,” and a shift from the hospital to jail might destabilize him.

Bashir is accused of shooting and wounding Laboy in an apparently random daylight attack in Old Town Alexandria, while first-graders at a nearby school were outside playing. Laboy, whose wife keeps a blog tracking his and his family’s road to restoring normalcy, has recovered significantly since the attack but still bears a long scar on his head and has suffered from seizures in recent months. He sat in the back of the courtroom during Thursday’s hearing and declined to comment afterward.

Get updates on your area delivered via e-mail