(CNN) -- A gunman intended to assassinate a U.S. representative when he opened fire outside a Tucson, Arizona, supermarket Saturday, killing six and wounding 12 including the congresswoman, the local sheriff said hours after the shooting.

U.S. Rep. Gabrielle Giffords was in critical condition late Saturday after surgery for a single gunshot wound to the head. The dead included a federal judge and a 9-year-old girl, authorities said.

One suspect was in custody immediately after the shooting, and investigators were "actively in pursuit" of a second man whom they believed may be involved in the attempted assassination, Pima County Sheriff Clarence Dupnik said Saturday night.

Two people tackled the suspected shooter, stopping a spray of bullets from what federal and state law enforcement sources described as a 9mm Glock outfitted with a 30-round magazine.

Dupnik said the suspect in custody is 22, but declined to name him. An Arizona law enforcement source and a federal law enforcement source, meanwhile, identified the suspect as Jared Lee Loughner.

The suspect was being held in the Pima County jail, Dupnik said. He was expected to appear in court Sunday morning,

Dupnik said investigators are not convinced that the suspect came to the supermarket alone. He said investigators were looking for a man seen near the suspect.

Authorities did not know whether the person they sought actually had any connection with Loughner, a law enforcement source told CNN.

CORRECTION

On Saturday, CNN showed a photo of a man in a football stadium believed to be Jared Lee Loughner, who is accused of shooting 18 people at a Tucson, Arizona political event. It was not him. CNN regrets the error.

Authorities have a piece of evidence that indicates this second individual was in close proximity to the store, the source said, but declined to elaborate.

Investigators were trying to interview witnesses to determine if there was a connection between the two men, the source said.

That source also said authorities were seeking search warrants for a residence and for a vehicle in connection with the suspect in custody.

The attack happened about 10 minutes after the start of a previously scheduled constituent meeting outside a Safeway grocery store.

Although U.S. Capitol Police said there was no evidence of a broader threat involving federal officials, the agency said in a statement it had advised other members of Congress to take "reasonable and prudent precautions regarding their personal safety and security."

The House Sergeant at Arms also said "it is essential" that lawmakers contact local police to register their home and office addresses.

Tucson Police Chief Roberto Villasenor said his department had secured the homes and offices of some unnamed federal officials as a "precautionary measure."

At a news conference, Dupnik said the shooter moved towards the crowd and began firing. It was unclear if he said anything or who was shot first, Dupnik said.

An employee of a nearby business, Jason Pekau, said he heard 15 to 20 shots.

Who is Gabrielle Giffords?

Suspect identified in mass killing

AZ shooting suspect may have had help

Rep. Giffords reads the 1st Amendment

Gallery: Rep. Gabrielle Giffords

Two people tackled the gunman, who still had ammunition remaining, Dupnik said.

Police recovered a 9mm Glock Model 19 handgun believed used in the shooting, according to senior law enforcement sources. The weapon had a 30-round magazine, according to a federal law enforcement source briefed on the investigation.

"He probably would have shot other people had he not been tackled," Dupnik said.

Five people, including Chief Judge John Roll of the U.S. District Court for Arizona and Gabe Zimmerman, a Giffords staffer, died at the scene. The sixth victim, a 9-year-old girl, was pronounced dead at a hospital.

Giffords, 40, was shot once in the head at close range, authorities said. She underwent surgery at University Medical Center in Tucson and was listed in critical condition.

Authorities said all of the victims have been identified, but declined to release additional names pending notification of relatives.

President Barack Obama sent FBI Director Richard Mueller to help coordinate the joint investigation, which federal authorities stressed did not appear to have any connection to terrorism.

Dupnik said the suspect has had contact with law enforcement in the past in which he made violent threats, but he declined to say against whom.

"All I can tell you is there's reason to believe this individual may have a mental issue," Dupnik said.

Nate Gray, special agent in charge of the Arizona office of the FBI, said the investigation was proceeding as a joint local and federal effort.

"The FBI and the Pima County Sheriff's office are working together on every aspect of this joint investigation and we are utilizing all resources necessary to make sure those responsible are brought to justice," Gray said.

Giffords' press secretary, C.J. Karamargin, said he was unaware of any recent threats against Giffords.

Dupnik said two incidents occurred in 2010 involving Giffords, including one in which a gun fell out of a constituent's pocket during an angry town hall meeting and another in which windows at her campaign office were broken out.

Authorities said they did not know the motive for the shooting -- the suspect was not talking and had invoked his right against self-incrimination, Dupnik said.

Giffords staffer Mark Kimble told CNN affiliate KGUN that the congresswoman did not have any security with her Saturday morning, which was not unusual for her.

Obama: Shooting is a tragedy

Friend: She's a phenomenal woman

Pelosi: Prayers, thoughts with Arizona

Gov. Brewer: Unbelievable tragedy in AZ

"She wants to be as accessible to the people who elected her as possible," Kimble said.

Dr. Peter Rhee of the University Medical Center said that Giffords had been moved to intensive care from surgery and said he was "very optimistic" about her recovery.

"I'm about as optimistic as it can get in this situation," he said during a brief news conference at the hospital Saturday afternoon.

He said the next 24 hours will be key for determining the extent of her recovery.

Dupnik reiterated Rhee's prognosis Saturday evening.

The staffer who died, Gabe Zimmerman, was in charge of community outreach in Giffords' Tucson office, Karamargin said. He was engaged to be married.

Giffords, a Democrat, was first elected in 2006. She has served as chairwoman of the House Space and Aeronautics Subcommittee and also holds seats on the House Science and Technology and Armed Services committees.

She won her third term in a closely contested race against a Tea Party-sponsored candidate and was one of three Democratic legislators who reported vandalism at their offices following the March vote on health care reform.

She is married to Navy Capt. Mark Kelly, a NASA astronaut who is scheduled to lead a space shuttle mission to the International Space Station.

Roll was a 1991 Bush appointee to the federal bench. The chief judge for the U.S. District Court for Arizona, he was originally from Pennsylvania.

Colleagues and admirers of Giffords and Roll reacted quickly to the shooting.

Sen. John McCain, R-Arizona, said the attack was committed by a "wicked person who has no sense of justice or compassion."

"Whoever did this, whatever their reason, they are a disgrace to Arizona, this country and the human race, and they deserve and will receive the contempt of all decent people and the strongest punishment of the law," he said.

Obama called the attack an "unspeakable tragedy."

"We do not yet have all the answers," he said. What we do know is that such a senseless and terrible act of violence has no place in a free society."

House Speaker John Boehner said he was "horrified" by the shooting.

"An attack on one who serves is an attack on all who serve," he said. "Acts and threats of violence against public officials have no place in our society."

Chief Justice of the United States John Roberts issued a statement decrying the shootings and the loss of Roll, whom he called a "wise jurist who selflessly served Arizona and the nation with great distinction."

"Chief Judge Roll's death is a somber reminder of the rule of law and the sacrifices of those who work to secure it," Roberts said.

Rep. Chellie Pingree, D-Maine, said an incident like this could have a chilling effect on the frequent weekend listening post sessions many members of Congress have with their constituents.