Tucson, Arizona (CNN) -- The suspect in the weekend massacre in Arizona was kicked out of an algebra class at a community college in June after repeated interruptions and clearly "needed psychological help," his instructor said Sunday.

Jared Lee Loughner was "physically removed" from the Pima Community College course less than a month after it began, its instructor, Ben McGahee told CNN. McGahee said Loughner sometimes shook, blurted things out in class, and appeared to be under the influence of drugs at times.

"I was scared of what he could do," McGahee said. "I wasn't scared of him physically, but I was scared of him bringing a weapon to class."

Loughner is now accused of opening fire at a Tucson supermarket where U.S. Rep. Gabrielle Giffords was hosting a meet-and-greet session with her constituents on Saturday. Six people were killed and 14 others wounded in the shooting.

Giffords remained in critical condition Sunday after being shot through the skull, while a federal judge, a congressional aide and a 9-year-old girl were among the dead.

Investigators found a letter from the congresswoman in a safe at the house where Loughner lived with his parents, thanking him for attending a similar 2007 event, according to court documents released Sunday.

"Also recovered in the safe was an envelope with handwriting on the envelope stating 'I planned ahead,' and 'my assassination' and the name 'Giffords,' along with what appears to be Loughner's signature," the affidavit states.

Federal authorities have now charged Laughner with first-degree murder, attempted murder counts and attempting to kill a member of Congress, counts that involve the shootings of federal employees. State prosecutors also could bring charges in the remaining cases.

The 9mm pistol used in the shootings was purchased at a gun store in November, FBI Director Robert Mueller told reporters Sunday. And a law enforcement source said the suspect tried to buy ammunition at a Walmart, but was turned down because of his behavior. Another Walmart later sold him the ammunition, the source said.

Loughner dropped out of high school in nearby Marana after his junior year, according to the school district. He got into the community college through a program aimed at helping high school dropouts transition to community colleges, Pima's president told CNN.

When he tried to enlist in the Army in 2008, the service rejected him for reasons it says it can't disclose due to privacy laws. But an administration official told CNN on Sunday that Loughner had failed a drug test.

In postings on the social media sites YouTube and MySpace, Loughner railed against government "mind control," being surrounded by people he considered illiterate and the illegitimacy of the U.S. government. In class, McGahee said Loughner accused him of violating his free-speech rights, "And of course free speech is limited in the classroom."

One such outburst was "the straw that broke the camel's back," and McGahee -- who had already raised concerns about Laughner with administrators -- had him removed.

Laughner "needed psychological help," and McGahee said he was not surprised to hear his former student was the suspect in Saturday's bloodbath.

"This guy was mentally disturbed. He was very isolated," he said.

In a statement issued Saturday night, Pima Community College said Loughner was suspended after a series of run-ins with campus police between February and September, capped by the discovery of a YouTube video in which he accused the college of operating unconstitutionally. Loughner quit school after the suspension, the college said -- and it warned him that to return, he had to present a doctor's note stating that his presence would not be "a danger to himself or others."

McGahee said the school responded to complaints about Loughner, but, "They didn't do it early enough."

"I think they did the best they can do, but as far as the time frame goes it could have been shortened," he said.

Loughner has invoked his right against self-incrimination and is not talking with investigators, Pima County Sheriff Clarence Dupnik said. He is scheduled to make an initial appearance before a federal magistrate in Phoenix on Monday, prosecutors said.

A federal public defender known for handling high-profile cases, Judy Clarke, has been appointed to represent him, a federal judicial source told CNN. Clarke previously defended the "Unabomber," Ted Kaczynski, and assisted in the case of confessed al Qaeda operative Zacarias Moussaoui.

The shootings killed U.S. District Judge John Roll, the presiding federal judge for Arizona, and Giffords aide Gabe Zimmerman. According to court papers, Roll came down to Tucson from Phoenix to discuss the volume of federal cases in Arizona with Giffords and had talked with one of her aides, Ron Barber, before the shooting. Barber and another Giffords staffer, Pamela Simon, were wounded in Saturday's shootings.

Roll is the fourth federal judge killed since 1979, when District Judge John Wood was slain in a contract killing outside his Texas home. In 1988, District Judge Richard Daronco of New York was killed by the father of a plaintiff whose case the judge had dismissed; and in 1989, Circuit Judge Robert Vance was killed by a mail bomb sent to his Alabama home by a man prosecutors said had a grudge against the appellate court on which Vance sat.

In addition, the husband and mother of District Judge Joan Lefkow were killed in their Chicago home in 2005. A man who committed suicide two weeks later in Wisconsin left a note confessing to the killings, blaming a judgment against him in a malpractice case for the loss of his house, job and family, police said.

Meanwhile, investigators have found, questioned and cleared a man they had sought as a "person of interest" after the killings. the FBI announced. The man was cab driver who dropped Loughner off at the Safeway where Giffords' "Congress on Your Corner" event was being held, a law enforcement official said Sunday.

A federal judge entered a plea of not guilty Monday on behalf of Jared Lee Loughner to three counts of attempted murder in the mass shooting that wounded U.S. Rep. Gabrielle Giffords earlier this month.