President Barack Obama on Friday called the flawed execution of an Oklahoma inmate “deeply troubling” and announced that he’s going to ask the attorney general to analyze problems surrounding the application of the death penalty in the United States.

In his first public comments on the case of convicted murderer Clayton Lockett, the president, who formerly taught constitutional law, expressed conflicting feelings about the death penalty and said Americans need to “ask ourselves some difficult and profound questions around these issues.”

Obama said the death penalty is warranted in some cases, specifically mentioning mass murder and child murder, and said Lockett’s crimes were “heinous.”

But he said the death penalty’s application in the United States is problematic, with evidence of racial bias and eventual exoneration of some death row inmates.

“All these, I think, do raise significant questions about how the death penalty is being applied,” said Obama said, who was asked about the Oklahoma execution at a White House news conference with visiting German Chancellor Angela Merkel. “And this situation in Oklahoma I think just highlights some of the significant problems there.”

The state of Oklahoma attempted to carry out Lockett’s death sentence Tuesday by lethal injection, using a drug combination that had not been previously used in the state. Lockett convulsed violently during the execution and tried to lift his head after a doctor declared him unconscious, then died of an apparent heart attack 43 minutes after the execution began.

“What happened in Oklahoma is deeply troubling,” Obama said when asked about international condemnation of U.S. application of the death penalty in light of Lockett’s case.

He said he’ll be asking Attorney General Eric Holder and others “to get me an analysis of what steps have been taken, not just in this particular instance, but more broadly in this area.” The White House and Justice Department declined to comment further on what the analysis might cover.

Lockett was already a four-time felon when he was convicted by a jury in 2000 of murder, rape, kidnapping, burglary and other charges and received his death penalty sentence. The murder victim was 19-year-old Stephanie Neiman, who came upon Lockett and two accomplices as they were beating a man in front of his 9-month-old son during a robbery.

Neiman and a friend came to the house while the robbery was in progress, and the robbers bound the two women with duct tape and raped Neiman’s friend. The three men then drove all four victims, including the baby, to a remote area, where Lockett shot Neiman with a sawed-off shotgun after she refused to say she wouldn’t report them to police. Lockett then watched as his two accomplices buried her alive.

Oklahoma Gov. Mary Fallin had called on Wednesday for an investigation of Lockett’s execution to be conducted by the state’s Department of Public Safety. She also said she would issue a stay on the execution of Charles Warner, who had been scheduled to be executed two hours after Lockett using the same drug combination.

Department of Public Safety spokesman Capt. George Brown said Friday that the autopsy, being performed in Dallas, is expected to be finished in eight to 12 weeks.