A gunman who killed a federal airport screener and wounded three others in a terrifying rampage at Los Angeles International Airport three years ago agreed to plead guilty to all counts in a deal that spares him the death penalty.

Paul Ciancia, 26, faces a mandatory life sentence for murder and other penalties, according to the plea agreement filed Thursday in U.S. District Court that calls for him to plead guilty to all charges.

Ciancia is charged with the murder of Transportation Security Administration officer Gerardo Hernandez at LAX on Nov. 1, 2013, when he opened fire and caused a panic that sent passengers and airport screeners running for their lives. It crippled the airport for hours and delayed air travel across the nation.

Ciancia was hell-bent on killing a TSA agent and causing fear among other screeners, according to a note signed by "Paul Ciancia Pissed-off Patriot" that was found in his luggage.

"If you made the conscious decision to put on a TSA costume and violate peoples' rights this morning, I made the conscious decision to try to kill you," he wrote, according to the court papers. "I want to instill fear in your traitorous minds. I want it to always be in the back of your head just how easy it is to take a weapon to the beginning of your Nazi checkpoints."

Officers quickly shot and arrested Ciancia, a New Jersey native, but it took hours to search the rest of the airport and determine there were no accomplices.

Federal prosecutors had sought the death penalty because the killing was premeditated, he intended to kill multiple people and it terrorized passengers and airport workers.

The unemployed motorcycle mechanic drew a .223-caliber assault rifle from a duffel bag and repeatedly shot Hernandez at an initial checkpoint and then returned to shoot him after seeing him move.

He shot and wounded two other uniformed TSA employees and an airline passenger at a checkpoint, though he spared most civilians who cowered in fear as he walked through an airport terminal.

The shooting exposed security lapses at LAX and led to changes in how emergency workers respond to such incidents after Hernandez lay on the floor without medical attention for 33 minutes.