Jared Loughner, forever associated with one of the worst U.S. shootings and the near-fatal wounding of Arizona Rep. Gabby Giffords, plans a plea deal that will keep him in prison for life. NBC's Pete Williams reports.

The man accused of shooting Congresswoman Gabrielle Giffords and 18 others in Tucson last year wants to plead guilty, according to sources familiar with the case.

The federal judge handling the case had scheduled a status hearing in Tucson for this Tuesday to get an update from prison doctors treating Jared Loughner, who's been undergoing mental health treatment in a Bureau of Prisons hospital since shortly after the shooting.

Loughner now wants to plead guilty at that hearing, and the doctors treating him are prepared to testify that he's mentally competent to offer the plea, these sources say.

Acceptance of a plea from Loughner will not be automatic. Under federal court rules, the judge must be satisfied that a guilty plea is "knowing and voluntary." That will require the judge to ask Loughner a series of questions in open court to make certain that he has the capacity to understand what a guilty plea means, including the fact that he gives up all his appeal rights.

A federal official says any agreement to accept the plea would require Loughner to serve a sentence of life in prison. If Loughner were to stand trial, he could face the death penalty if convicted. If the judge accepts the guilty plea, then the sentence would be determined later, after another hearing.

The shooting, outside a supermarket in Tucson, severely wounded Giffords, killed six people, and wounded 12 others.

Legal sources say the terms of any plea agreement are still being worked out, and it's not clear whether he would plead guilty to all the charges in the federal indictment or only some of them.

Stay informed with the latest headlines; sign up for our newsletter

The attack in Tucson came as Giffords was sponsoring an event to meet constituents outside a store. Among the victims who were slain were federal Judge John Roll; 9-year-old Christina-Taylor Green, who was born on Sept. 11, 2001, and Gabe Zimmerman, a Giffords staffer.

Giffords spent more than a year in Houston undergoing intensive physical and speech therapy in a recovery that doctors and family have called miraculous. But she was unable to fully return to Congress and resigned in January this year.

Ron Barber, a Giffords staffer who survived two gunshot wounds in the Tucson attack, won her seat in a special election in June.

Pete Williams is NBC News' chief justice correspondent.

A sources says that Jared Loughner, the man accused of killing six people and wounding Gabrielle Giffords in 2011, is set to plead guilty in a Tucson court on Tuesday. NBC's Diana Alvear reports.

More content from NBCNews.com:

Follow US News from NBCNews.com on Twitter and Facebook