LOUISVILLE, Ky. (AP) – The man accused of shooting at a Louisville mayoral candidate had visited the politician’s home the day before the attack, but left after the gun he brought with him jammed, according to new details alleged by federal prosecutors during a hearing Friday.

Quintez Brown, 22, wanted to kill Craig Greenberg to prevent him from winning the upcoming mayoral election, prosecutors argued, citing Brown’s internet search history, text messages, and online posts around the time of the February shooting.

The day before, Brown took a Lyft ride to the candidate’s home and, minutes later, searched the internet for instructions on how to fix a gun loaded with a backward bullet, prosecutors said. He then left.

Magistrate Judge Colin Lindsay on Friday granted Brown’s release to home incarceration, but the suspect remains in federal custody because the judge also granted a request from federal prosecutors to pause the release while they file an appeal.

In arguing against Brown’s pretrial release, prosecutors asserted that Brown was “erratic, unpredictable, and likely to disappear,” and warned that he could attempt another shooting.

Greenberg, a Democrat, said he was at his campaign headquarters on Feb. 14 with four colleagues when a man appeared in the doorway and began firing multiple rounds. One staffer managed to shut the door, which they barricaded using tables and desks, and the shooter fled.

Greenberg was not hit by the gunfire but said a bullet grazed his sweater.

Brown, a social justice activist who was running as an independent for Louisville’s metro council, was arrested shortly after.

The morning of the shooting, prosecutors said that Brown purchased another gun at a local pawn shop. He then took a Lyft ride to Greenberg’s campaign’s office, where the attack occurred.

Last week, a federal grand jury indicted Brown on charges of “interfering with a federally protected right, and using and discharging a firearm in relation to a crime of violence by shooting at and attempting to kill a candidate for elective office.”

If convicted of all federal charges, Brown faces a mandatory minimum of 10 years in prison and a maximum sentence of life in prison in addition to any sentence he receives on state charges of attempted murder and wanton endangerment. He has pleaded not guilty in state court.

Brown’s attorneys said they acknowledged the serious nature of the allegations, but insisted that Brown be released, saying incarceration would have a detrimental impact on Brown’s mental health and wellbeing.

They argued that if Brown is allowed to be on home incarceration, he would have consistent access to mental health resources and the support of his family and would not be a danger to the community. They also said that before his arrest last week, Brown had been on home incarceration for weeks without any issues.

Days after the shooting, Brown had been placed on home incarceration and fitted with a GPS ankle monitor after a group called the Louisville Community Bail Fund paid the $100,000 cash bond.

The earlier decision to place him on home incarceration drew bipartisan criticism, including from Greenberg, who said it was “nearly impossible to believe that someone can attempt murder on Monday and walk out of jail on Wednesday.”

A few of Brown’s professors and supervisors from the University of Louisville testified in support of his release Friday. Dr. Ricky Jones, a professor of Pan-African Studies at the University of Louisville, said that Brown was a“star of the university” and a talented writer.

Brown, a former intern and editorial columnist for the Courier Journal, had been prolific on social media before the shooting, especially when it came to social justice issues. He was also involved in community violence prevention efforts and was a Martin Luther King Scholar at the University of Louisville, which included a full-ride scholarship.

Brown disappeared for about two weeks last summer. After he was found safe, his parents issued a statement asking for patience and privacy while they attended to his “physical, mental and spiritual needs.”

“He was one of the most brilliant kids I’ve ever met,” Jones said, describing Brown as very respectful, analytical, and well-liked. Jones also noted that he would even let Brown live with him if that was what the court wanted.

At one point during his testimony, Jones’ voice started to shake and he became emotional. Several people sitting in the pews in the back of courtroom also began to cry.

“I really wonder what happened to him,” he said.