An Alaska man has agreed to plead guilty and serve a life sentence to avoid the death penalty on charges of killing five people and wounding six in a shooting rampage at the Fort Lauderdale-Hollywood International Airport, authorities announced Tuesday.

The plea agreement detailed in court requires Esteban Santiago to give up his rights to appeal his conviction and sentence, his attorneys and federal prosecutors said. His actual guilty plea and sentencing would occur at a later date after a mental evaluation.

Santiago, 28, of Anchorage, Alaska, is charged in a 22-count indictment in the January 2017 shooting in a baggage claim area. Trial had been set to begin June 11.

U.S. District Judge Beth Bloom asked Santiago, dressed in a tan jail outfit and in chains, if he understood the agreement he was making.

“Yes, your honor,” he replied.

The indictment charged Santiago flew on a one-way ticket from Alaska to Fort Lauderdale with a 9 mm handgun in a box he checked as luggage. After landing he retrieved the weapon, loaded it in a restroom and came out firing randomly until he exhausted his ammunition.

Since his arrest, Santiago has been treated at a Miami jail for schizophrenia, but his lawyers say he is mentally fit for trial. He complained of mental problems before the shooting but was not barred from possessing a gun.

Bloom said she wanted a mental evaluation done before accepting the plea deal because of the constitutional rights Santiago would be giving up. She set a mental competency hearing for May 23.

“That is the court's utmost concern,” she said.

Assistant U.S. Attorney Rick Del Toro said the agreement was approved by senior Justice Department officials and in consultation with families of the slain victims. In the federal system, all prosecutions in which the death penalty is a possibility must be approved by the attorney general.

“The attorney general has given us the authority not to seek the death penalty,” Del Toro said.

After the shooting, the FBI says Santiago told agents in a confession that he acted under government mind control, then claimed inspiration by Islamic State extremists. No terrorism links have been found.

The FBI says numerous airport security cameras recorded the shooting on video and there are dozens of witnesses who can identify Santiago as the shooter.

Santiago, a National Guard Iraq veteran, was treated at an Anchorage psychiatric hospital after he showed up at the local FBI office saying he was under CIA mind control and was hearing voices. He was released after a brief stay and given anti-anxiety medicine.

His gun, which had been confiscated by police during that time, was returned to him and was used a few weeks later in the Florida shooting.

Curt Anderson reports for the Associated Press.