Jan. 8, 2011  -- The man who allegedly shot Arizona Rep. Gabrielle Giffords and killed six others today in Arizona has been identified as 22-year-old Jared Lee Loughner, ABC News has learned.

Giffords, who was shot in the head but survived, was the target of the daytime attack with a semi-automatic handgun that killed six people, including federal judge John Roll and a 9-year-old girl, and injured 13 others, police said. In the middle of the assault, police said two men tackled Loughner and forcibly subdued him until authorities arrived. Giffords' director of community outreach, Gabe Zimmerman, was killed and two other members of Giffords' staff were injured.

The FBI has joined the investigation into the shooting as authorities are poring over an online trail of bizarre, anti-government rants apparently left by Loughner. On a Myspace page in Loughner's name, he said goodbye to friends just hours before the shooting and said, "Please don't be mad at me... I cannot rest."

Prima County Sheriff Clarence Dupnik, who only identified the shooter as a 22-year-old white male, said the evidence online and information they've received from two schools that Loughner attended led him to believe the gunman was "unstable."

"There's reason to believe that this individual may have a mental issue," Dupnik told reporters today. "I'm not a psychiatrist so I have no reason to believe the person was insane. Was he unstable? I would agree with that."

This March 2010 photo shows a man identified as Jared L. Loughner at the 2010 Tucson Festival of Books in Tucson, Ariz.

Dupnik said the shooter had previous run-ins with the law and had threatened to kill someone before.

There had been "difficulties" at Pima Community College where Loughner attended, Dupnik said. One student, who had a poetry class with Loughner, said he would often act "wildly inappropriate."

"One day he started making comments about terrorism and laughing about killing the baby," classmate Don Coorough told ABC News, referring to a discussion about abortions. "The rest of us were looking at him in shock… I thought this young man was troubled."

Another classmate, Lydian Ali, recalled the incident as well.

"A girl had written a poem about an abortion. It was very emotional and she was teary eyed and he said something about strapping a bomb to the fetus and making a baby bomber," Ali told ABC News.

YouTube Video: 'If You Call Me a Terrorist...'

Loughner reportedly recently made several YouTube videos with walls of text protesting the government and ranting against low literacy rates and illegitimate currency.

"Hello, my name is Jared Lee Loughner. This video is my introduction to you!" one video, uploaded Dec. 15, says. "My favorite activity is conscience dreaming; the greatest inspiration for my political business information. Some of you don't dream -- sadly... My ambition -- is for informing literate dreamers about a new currency; in a few days, you know I'm conscience dreaming! Thank you!"

In another video, he accuses the government of mind control via grammar.

"In conclusion, reading the second United States Constitution, I can't trust the current government because of the ratifications: The government is implying mind control and brainwash on the people by controlling grammar. No! I won't pay debt with a currency that's not backed by gold and silver! No! I won't trust in God!" it says.

In another video posted on YouTube, Loughner uses repetitive, convoluted logic when defining terrorism.

"If I define terrorist then a terrorist is a person who employs terror or terrorism, especially as a political weapon. I define terrorist. Thus, a terrorist is a person who employs terror or terrorism, especially as a political weapon," the video, entitled "Introduction: Jared Loughner," says. "If you call me a terrorist then the argument to call me a terrorist is Ad hominem. You call me a terrorist. Thus, the argument to call me a terrorist is Ad hominem."

In the YouTube profile, the account holder, identified as Loughner, lists "The Communist Manifesto" and "Mein Kampf" among his favorite books.

Laughner's Myspace page features a picture of a handgun on a U.S. history textbook. A senior military official told ABC News Loughner attempted to join the Army but "never made it past the urinalysis."

A high school classmate of Loughner's said he was extremely political in high school, but not radical. The classmate said Loughner once met Giffords in 2007 and said he thought the congresswoman was "unintelligent."

Police are still on the hunt for another man they said may have been involved in the shooting.

ABC News' Elisa Roupenian and Emily Friedman contributed to this report.