Jared Lee Loughner has pleaded guilty to carrying out the deadly Arizona mass shooting in January 2011 that was a failed attempt to kill US Congresswoman Gabrielle Giffords.
Six people were killed and 13 injured, including the congresswoman.
By pleading guilty, the 23-year-old will avoid the death penalty but will face a life sentence without the possibility of parole, the prosecution explained during the hearing at a federal court in Tucson.
Loughner also waived all right to appeal.
Dressed in a tan prison jumpsuit, his hair cut short, the defendant appeared calm and showed little emotion as he answered the judge's questions.
"Yes, it is" true, he told the judge, confirming that he approached Giffords, 41, intending to kill her.
Loughner's lawyer, Judy Clark, said her client was agreeing to plead guilty "knowingly, voluntarily, and intelligently".
A few minutes earlier, Federal Judge Larry Burns had declared the defendant mentally competent to understand and admit to the charges against him.
Loughner has been receiving psychiatric treatment for more than a year for schizophrenia on the court's orders.
He had previously pleaded not guilty, but Burns decided at the time he was not competent to stand trial.
Loughner opened fire on January 8, 2011, outside a Tucson supermarket where Giffords, a Democrat, was meeting with constituents.
Among the six dead were a federal judge, a nine-year-old girl and a member of the congresswoman's staff.
Giffords, who had been seen as a rising star in the Democratic Party, resigned her position in January to focus on her remarkable but continuing recovery.