Media playback is unsupported on your device Media caption Gabrielle Giffords was the intended target, Sheriff Clarence Dupnik said

A US congresswoman is in critical condition after a gunman shot her in the head and killed six people in an Arizona shooting spree.

Democratic Representative Gabrielle Giffords was shot at close range at a public meeting in a Tucson supermarket.

The 40-year-old is under sedation, but the doctor treating her said he was "very optimistic about her recovery".

A 22-year-old man has been arrested and police are hunting for a second man in connection with the shooting.

The suspect in custody, who was wrestled to the ground at the scene of the shooting, has been named locally as Arizona resident Jared Loughner, who is described as having a troubled past.

Various former classmates have described him as "obviously disturbed" and a loner who had posted a number of anti-government videos and messages on social networking websites.

Confirmed Dead Judge John Roll, 63

Christina-Taylor Green, nine

Gabe Zimmerman, 30

Dorothy Morris, 76

Dorwin Stoddard, 76

Phyllis Scheck, 79

Shortly before the attack he had posted: "Goodbye friends. Dear friends, don' be mad at me."

A Giffords family friend, Tillman Fertitta, told ABC News that the congresswoman's condition would be "very tough for next few days and even after that".

He added: "She was conscious before surgery. She is in an induced coma now and will be for a few days - they have to make sure the brain continues to operate well."

'Outrageous bigotry'

Local police, who have not confirmed the suspect's name, said they were hunting for a possible accomplice, who may have driven the suspect to the supermarket.

Suspect gunman: Jared Loughner Image caption The suspect has been described as a loner Aged 22; lives with parents in Tucson

Described by former class-mates as "disruptive" drug-user and a loner

Reportedly posted series of rambling messages on social networking websites

Online messages show deep distrust of government and religion, calling US laws "treasonous" and calling for creation of a new currency

Attempted to enlist in US Army but was rejected Profile: Jared Loughner

They have released a CCTV image of a dark-haired man, described as aged between 40 and 50 and wearing a blue jacket and jeans at the time of the attack.

Left-wing commentators have accused right-wing politicians of creating a climate of hatred that allows such attacks.

The rhetoric that instantly sprang up around the shootings shows the volatile, febrile state of American politics, says BBC North America editor Mark Mardell in Washington.

Pima County Sheriff Clarence Dupnik said a consuming atmosphere of political vitriol centred on Arizona may have been a factor.

"The anger, the hatred, the bigotry that goes on in this country is getting to be outrageous," he said. "And unfortunately, Arizona, I think, has become the capital. We have become the Mecca for prejudice and bigotry."

This anger had spilled into violence before, with Ms Giffords' office being vandalised last March after she upset Arizona conservatives by supporting Mr Obama's healthcare reform bill.

Sheriff Dupnik said the congresswoman had been threatened by someone with a gun during her re-election campaign in November, adding that there had been other threats.

Mark Mardell's America It is an indication of the febrile, volatile nature of politics in America that, immediately the news broke, the internet was alive with anger, a dispute between the left and the right Read Mark's thoughts in full

House Speaker John Boehner vowed on Sunday that the shootings would "not deter us from our calling to represent our constituents".

He added: "No act, no matter how heinous, can be allowed to stop us from our duty."

Former Alaska Governor Sarah Palin, a conservative Republican, had placed Ms Giffords on a list of politicians she wanted to remove from office in November's mid-term polls.

As a moderate Democrat who narrowly defeated a so-called Tea Party candidate in the elections, Ms Giffords had referred to the hatred during an interview with MSNBC.

"We're on Sarah Palin's targeted list, but the thing is, that the way that she has it depicted has the crosshairs of a gun sight over our district. When people do that, they have to realise that there are consequences to that action," she said.

Rebecca Mansour, an aide to Mrs Palin, told local radio on Sunday that "we never ever, ever intended it to be gun sights".

Mrs Palin has issued a statement offering her condolences to the families of Ms Giffords and the other victims of the attack.

Indiscriminate shooting

The attacker struck as Ms Giffords held one of her regular open-invitation meetings - which she called "Congress on your corner" - with her constituents outside the Safeway supermarket in Tucson at around 1000 (1700 GMT) on Saturday.

GABRIELLE GIFFORDS Represents the eighth district of Arizona in the House

First elected in 2006, re-elected to third term last November

Has focused on immigration reform, military issues, stem-cell research and alternative energy

Grew up in Tucson, Arizona

Married to US astronaut Mark Kelly Profile: Gabrielle Giffords In pictures: Gabrielle Giffords

Eyewitnesses say the gunman approached Ms Giffords and shot her at close range. Later reports from the hospital said a bullet passed through her head without exploding.

The attacker then fired some 20 shots indiscriminately before being overpowered by members of the crowd as he attempted to reload what one witness described as a semi-automatic Glock pistol.

He was then hauled away by police, witnesses said.

Local media report the suspect has so far refused to speak.

The six dead included a nine-year-old girl, federal Judge John Roll - who had served Arizona's legal system for 40 years - and one of Ms Giffords' political aides.

In addition to the six deaths, police said 14 people - including Ms Giffords - had been wounded.

Outside the Tucson hospital where the victims were taken, several people have laid candles held an overnight vigil. A few miles away, both the scene of the attack and some streets around the suspect's home - where he lived with his parents - remain cordoned off.

'Alert and conscious'

As the US comes to terms with the tragedy, witnesses have been giving their accounts of the attack.

Image caption Arizona police have asked for the public's help in identifying this man

Alex Villec, a 19-year-old volunteer at the event, said he had been approached by a "shady-looking" man wearing a black cap and baggy trousers who asked to speak to the congresswoman.

He told the man to wait in line, but said he returned moments later and burst through a table separating Ms Giffords from the public.

Another witness said he saw the gunman shoot Ms Giffords in the head before "just spraying gunfire everywhere".

"At that point I ducked behind the concrete post," said the witness, Dr Steven Rayle. "I acted like I had been shot and was dead so I wouldn't be a target."

One of the men who helped wrestle the gunman to the ground said he had two more ammunition clips and a knife in his pockets.

"He was ready for war, he was not playing around," Joe Zamudio told CNN television. "He was blank. He was callous, almost."

A Giffords' intern, Daniel Hernandez, told ABC he had applied first aid to the congresswoman and her staff.

"I had to lift up the congresswoman becasue she was severely injured. I wanted to make sure she was able to breathe because there was so much blood.

Media playback is unsupported on your device Media caption President Obama: "A tragedy for our entire country"

"She was alert and conscious and was able to hold my hand when I asked her if she could hear me but I couldn't get any words from her."

US President Barack Obama said the shooting was a "tragedy for our entire country", and urged the nation to "come together and support each other".

FBI director Robert Mueller is heading to Arizona to coordinate the investigation.

Ms Giffords, who represents the eighth district of Arizona in the House of Representatives, is married to space shuttle astronaut Mark Kelly.

Described as a "a rising star" in the Democrats with hopes of eventually winning the Arizona Senate seat, she has served on several congressional committees, including those covering the armed services and foreign affairs, and is a member of the "blue dog" group of centrist Democrats.

All of next week's legislative debates in the House have been postponed.