Jared Lee Loughner, the alleged gunman in the Tucson shooting of the US congresswoman Gabrielle Giffords, had been behaving increasingly erratically in recent months.

The 22-year-old army reject had posted rambling videos online in which he made statements about mind control, Swat teams and the gold standard. On his MySpace page he posted a photograph of a handgun resting on top of a United States history textbook.

The motivations for the shootings remained unclear. The Pima County sheriff, Clarence Dupnik, described Loughner as mentally unstable and said he may have had an accomplice.

In October 2007 Loughner was cited in Pima County for possession of drug paraphernalia, a charge that was dismissed after he completed a diversion program, according to online records. "He has kind of a troubled past, I can tell you that," Dupnik said.

Former schoolmates said Loughner, who remains in police custody, smoked marijuana and was prone to outbursts in class.

In one YouTube video he described himself as a US military recruit, but the US army confirmed he had been rejected for military service in 2008 for reasons it could not disclose.

Loughner had been a student at Pima Community College, but one of the videos he posted online was considered so disturbing by campus administrators that they suspended him in September.

Loughner and his parents attended a meeting with college officials who said he would require mental health clearance if he wanted to return, the New York Times reported.

Investigators have been scouring Loughner's MySpace page, which was removed within minutes of him being identified as the suspect. At about 5am on Saturday, he had written: "Goodbye [...] Dear friends ... Please don't be mad at me."

In one of several internet postings, Loughner suggested the government was trying to take advantage of him in some way. One video was called "My Final Thoughts: Jared Lee Loughner!".

In another posting, he wrote: "All humans are in need of sleep. Jared Loughner is a human. Hence, Jared Loughner is in need of sleep."

He also wrote about terrorism. "If I define terrorist, then a terrorist is a person who employs terror or terrorism, especially as a political weapon. I define terrorist," he wrote. "If you call me a terrorist then the argument to call me a terrorist is ad hominem. You call me a terrorist."

His YouTube page listed a series of favorite books, including Animal Farm by George Orwell and Brave New World by Aldous Huxley.

In a video featuring text against a dark background, Loughner described inventing a new US currency and complained about the illiteracy rate among people living in Giffords's congressional district in Arizona.

"I know who's listening: Government officials, and the People," Loughner wrote. "Nearly all the people, who don't know this accurate information of a new currency, aren't aware of mind control and brainwash methods. If I have my civil rights, then this message wouldn't have happen."

Today, the street where Loughner lived with his parents – a middle-class neighbourhood five minutes from the scene of the shooting – was blocked off by police. Neighbours said Loughner could often be seen walking his dog, almost always wearing a hooded sweatshirt and listening to his iPod. He grew up in Tucson and had been an unremarkable student at Mountain View high school, classmates said.

One high school peer, Grant Wiens, 22, said Loughner seemed to be "floating through life" and "doing his own thing".

He said: "Sometimes religion was brought up, or drugs. He smoked pot, I don't know how regularly. And he wasn't too keen on religion, from what I could tell."

Lynda Sorenson said she took a class with Loughner last summer at Pima community college. He was "obviously very disturbed", she told the Arizona Daily Star. "He disrupted class frequently with nonsensical outbursts."

Gabriella Carillo, 22, said she remembered Loughner as a tall, intelligent teenager who was good at basketball, liked to read and worked hard in his high school band classes, but didn't seem to apply himself in other courses.

"I know that he caused a lot of trouble in his classes other than band," she said. "If he tried, he would probably be at the top of our class. But he kind of just wasted his life.

"There are some guys who are just angry," she said. "I never really saw a smile on his face at all."

Don Coorough, 58, who sat two desks in front of Loughner in a poetry class, described him as a "troubled young man" and "emotionally underdeveloped". After another student read a poem about an abortion, Loughner compared the young woman to a "terrorist for killing the baby", he said.