A federal judge ruled Wednesday that shooting suspect Jared Lee Loughner is mentally unfit to stand trial for the Jan. 8 rampage in Tucson that wounded Rep. Gabrielle Giffords and killed six other people, citing expert testimony that Loughner is schizophrenic and shows a paranoid distrust of his own defense attorneys.

Facing an agitated Loughner in a Phoenix courtroom, U.S. District Judge Larry Burns remanded him to a federal facility in Springfield, Mo., where he will receive treatment aimed at restoring his competency. The judge ordered that Loughner be treated for up to four months, and if he is then deemed to be competent, the case against him could resume. If not, he could remain in treatment.

Federal prosecutors expressed confidence that Loughner eventually will be tried, but the ruling nevertheless introduced the possibility of indefinite delays in a case that has been closely watched by millions of Americans. Since the shooting, which also wounded 12 others, Giffords’ recovery has been chronicled by the media and prosecutors have gradually laid out the evidence they have compiled against Loughner.

Giffords, D-Ariz., who was shot above her left eye, remains in a Houston medical center, where last week surgeons repaired a section of her skull with a ceramic implant. Just days before, she witnessed her husband, astronaut Mark Kelly, ascend into space aboard the space shuttle Endeavour.

Entering Wednesday’s hearing, Loughner, wearing a khaki prison suit, could be heard mumbling that the proceedings were “treasonous,” according to a witness. Also, The Associated Press reported that Loughner said what sounded like, “Thank you for the freak show. She died in front of me,” before being escorted from the courtroom.

Loughner reportedly watched the end of the hearing on closed-circuit television after the judge gave him the option of restraining his outbursts or leaving the courtroom.

A spokesman for U.S. Attorney Dennis Burke, who is prosecuting the case, predicted that Loughner would be successfully medicated — willingly or forcibly — and then stand trial.

“We believe that Jared Loughner can be restored to competency through proper medication, and we’re pursuing that course,” Robbie Sherwood said in a telephone interview. “This practice is common,” he said, adding that in “the vast majority of cases where defendants are declared not competent, they have been restored and go on to proceed with the cases.”

A call seeking comment from Loughner’s defense team at the Phoenix federal public defender’s office was not returned Wednesday.

Some legal experts disputed Sherwood’s contention and cautioned that restoring the mental capacity of schizophrenic defendants can take years.

Joseph diGenova, a former U.S. attorney in the District of Columbia, pointed to the case of Eugene Weston, who fatally shot two federal officers at the U.S. Capitol in 1998. Weston, found to be a paranoid schizophrenic, remains in a mental institution and has not gone on trial.

DiGenova, who helped prosecute presidential shooter John Hinckley, said that in Loughner’s case, “whether psychotropic medication can get him to a balanced competence so that he can assist his lawyer and understand the nature of the case against him remains to be seen. . . . It’s not inconceivable that he would be in a mental institution for many years.”

At least two of the shooting victims — Giffords aide Pam Simon and retired Army Col. Bill Badger — were in the courtroom Wednesday. Sherwood said that they, along with relatives of other victims who were present, were briefed by the U.S. Attorney’s Office before and after the hearing.

“None of this is going to bring our son back,” said Ross Zimmerman, father of Giffords staffer Gabe Zimmerman, who died in the shooting. “We don’t have any animosity toward the poor kid. . . . Punishment isn’t part of our thought process.”

The judge’s ruling came after he reviewed the findings of two court-appointed mental health professionals who had examined Loughner during his five months at the federal facility in Springfield.

Psychologist Christina Pietz and psychiatrist Matthew Carroll agreed that Loughner’s behavior met the standard of mental incompetence.

Sherwood stressed that Loughner will “stay at the Bureau of Prisons indefinitely if he is deemed a danger to the public or himself. And we’ve made a pretty good argument for that. If anywhere down the line his condition improves, if he snaps out of it, the charges will be reinstated.”

Loughner will be treated by doctors, who likely will prescribe medication to treat psychosis. If he refuses the drugs, the court could petition Burns to order forcible treatment, such as injections, experts said.