TUCSON, Ariz. - Doctors treating wounded Rep. Gabrielle Giffords provided an optimistic update Sunday about her chances for survival, saying they are "very, very encouraged" by her ability to respond to simple commands along with their success in controlling her bleeding.

Surgeons said a bullet went through Giffords' head on the left side of the brain, but she is still able to respond nonverbally to commands such as squeezing a hand or showing two fingers. They credited several reasons for her survival, including good luck and the fact that paramedics got her to surgeons quickly - in under 40 minutes.

"This is about as good as it is going to get," said Dr. Peter Rhee, a trauma surgeon. "When you get shot in the head and the bullet goes through your brain, the chances of you living is very small and the chances of you waking up and actually following commands is even much smaller than that. Hopefully it will stay that way."

Surgeons worked to reduce pressure from swelling in her head by removing bone fragments, and they also removed a small amount of badly damaged brain. Giffords cannot speak because she is on a ventilator.

Dr. Michael Lemole of the University Medical Center in Tucson would not speculate on her degree of recovery. "We talk about recovery in months to years," he said.

The medical prognosis came as authorities investigated the motivation of a gunman in an attempted assassination of the three-term Democrat and the killing of six people, including a federal judge, an aide to Giffords and a 9-year-old girl who was born on Sept. 11, 2001.

Mourners crammed into the tiny sanctuary of Giffords' synagogue in Tucson to pray that she quickly recovered. Outside the hospital, candles flickered at a makeshift memorial. Signs read "Peace + love are stronger," "God bless America and "We love you, Gabrielle." People also laid down bouquets of flowers, American flags and pictures of Giffords.

Authorities said Giffords, 40, was targeted at a public gathering by a man with a semiautomatic weapon around 10 a.m. Saturday outside a busy Tucson supermarket. Fourteen people were injured.

He also fired at her district director and shot indiscriminately at staffers and others standing in line to talk to the congresswoman, said Mark Kimble, a communications staffer for Giffords.

"He was not more than three or four feet from the congresswoman and the district director," Kimble said, describing the scene as "just complete chaos, people screaming, crying."

One of the victims was Christina-Taylor Green, who was a member of the student council at her local school and went to the event because of her interest in government. She is the grandaughter of former Philadelphia Phillies manager Dallas Green.

She was born on 9/11 and featured in a book called "Faces of Hope" that chronicled one baby from each state born on the day terrorists killed nearly 3,000 people.

The fact that Christina's life ended in tragedy was especially tragic to those who knew her. "Tragedy seems to have happened again," said the author of the book, Christine Naman. "In the form of this awful event."

Police say the shooter was in custody, and was identified by people familiar with the investigation as Jared Loughner, 22. U.S. officials who provided his name to the AP spoke on condition of anonymity because they were not authorized to release it publicly.

His motivation was not immediately known, but Dupnik described him as mentally unstable and possibly acting with an accomplice.

His office said a man possibly associated with Loughner (pronounced LAWF'-ner) who was near the scene was being sought. The man, who was photographed by a security camera, was described as white with dark hair and 40-45 years old.

The assassination attempt left Americans questioning whether divisive politics had pushed the suspect over the edge.

Giffords faced frequent backlash from the right over her support of the health care reform last year, and had her office vandalized the day the House approved the landmark measure.

Pima County Sheriff Clarence Dupnik lashed out at what he called an excessively "vitriolic" atmosphere in the months leading up to the rampage as he described the chaos of the day.

The sheriff said the rampage ended only after two people tackled the gunman.

"He was definitely on a mission," according to event volunteer Alex Villec, former Giffords intern.

A shaken President Barack Obama called the attack "a tragedy for our entire country."

Attorney General Eric Holder said in a statement Sunday that FBI Director Robert Mueller was traveling to Arizona to help coordinate the investigation.

In a brief statement Sunday morning, House Speaker John Boehner said flags on the House side of the Capitol in Washington will be flown at half staff to honor Giffords' slain aide, Gabe Zimmerman. Boehner says normal House business this week is postponed to focus on any necessary actions in the shooting aftermath.