OKLAHOMA CITY — Oklahoma’s attorney general agreed Thursday to a six-month stay of execution for a death row inmate while an investigation is conducted into last week’s botched lethal injection.

Attorney General Scott Pruitt’s office filed court documents saying it wouldn’t object to a 180-day stay of execution being sought by attorneys for inmate Charles Warner. While the stay request only applies to Warner, Pruitt and Gov. Mary Fallin have said the state will not carry out any executions until the investigation is complete, which is expected to take at least eight weeks.

Warner was scheduled for execution on the same night last week as Clayton Lockett in what would have been the state’s first double execution since 1937. But Lockett’s vein collapsed during his lethal injection, prompting prison officials to halt the execution. He later died of a heart attack.

Fallin then issued a two-week stay of execution for Warner, but his attorneys asked for a six-month delay. Pruitt’s office agreed in a motion filed with the Oklahoma Court of Criminal Appeals, and if the court agrees, Warner’s execution would be postponed until Nov. 13.

“Should additional time be needed for the implementation of any changes or adjustments, the state will request it,” Assistant Attorney General Seth Branham wrote.

The investigation into Lockett’s botched execution is expected to take between eight and 12 weeks and will include an autopsy and toxicology tests on Lockett, said Capt. George Brown, a spokesman for the Department of Public Safety, which is conducting the probe.

Lockett writhed on the gurney, gritted his teeth, lifted his head several times and moaned before dying of an apparent heart attack 43 minutes after the start of his execution. A doctor inside the death chamber during the execution reported that Lockett’s vein collapsed and some of the lethal drugs were absorbed into his tissue or leaked out. It was the first time the state had ever used the sedative midazolam as the first in a three-drug lethal injection protocol.

The curtains that allow witnesses to view the execution were closed about 16 minutes into the lethal injection, after Lockett had been showing signs of distress for several minutes. The director of the state’s prison system, Robert Patton, then called off the execution, but Lockett died about 10 minutes later.

Patton released a report saying Lockett had an intravenous tap placed at his groin because suitable veins couldn’t be found elsewhere in his body. That vein collapsed, and Patton said Lockett didn’t have another viable one — and that the state didn’t have another dose of the drugs available.

Patton has called for an “indefinite stay” while the state reviews its execution procedures and trains its staff on new protocols.

Warner’s attorney, Madeline Cohen, said she was pleased the attorney general agreed to the 180-day stay, but she noted Warner still is scheduled to die on Tuesday.

“The court needs to rule and get this execution stayed so that Mr. Warner does not have a Tuesday execution hanging over his head,” Cohen said. “Then there needs to be a full, and hopefully independent, investigation.”

Cohen and attorneys for Lockett are among those who have criticized Fallin for tapping one of her cabinet members, Secretary of Safety and Security Michael Thompson, to head up the investigation. Thompson is a former Department of Corrections employee and witnessed Lockett’s execution.