It was Nov. 17, 2022, and Kenneth Smith was lying on a gurney inside Alabama’s execution chamber, his arms and legs strapped down as he waited to be put to death. Mr. Smith, who had been on death row for more than a quarter-century after being convicted of murdering a woman, recalled thanking God for his final week alive and thinking of his family.

At the time, the state was using the same method of execution that has been used in the vast majority of modern U.S. executions: lethal injection. And like many other states, Alabama had problems. That night, a team of people tried and repeatedly failed to insert an intravenous line into Mr. Smith’s arms and hands and, eventually, a vein near his heart. The jabbing stopped — according to his lawyers, who recounted in court documents Mr. Smith’s experiences that night — when prison officials decided that they might not have time to carry out the execution before the death warrant expired at midnight.

Now, more than a year later, Alabama is preparing once again this week to execute Mr. Smith, this time employing a method that has never been used in a U.S. execution: nitrogen hypoxia. Under this method, which has been used in assisted suicides in Europe, Mr. Smith will be fitted with a mask and administered a flow of nitrogen gas, effectively depriving him of oxygen until he dies.

The execution, scheduled for Thursday evening, is the latest turn in the fraught battle over executions in the U.S., where a growing number of states are banning the death penalty; those that retain the punishment are finding it difficult to carry out. Pressure from activist and medical groups has made it challenging for prison officials to procure lethal drugs, and a series of executions in the last two years were plagued by trouble finding veins. Alabama is one of several states that are looking at alternatives, including nitrogen hypoxia, and some states have recently authorized the use of a firing squad.

This week’s planned execution has galvanized death penalty critics who say that Alabama prison officials are making Mr. Smith a test subject for an unproven and potentially macabre experiment. State officials argue that death by nitrogen hypoxia is painless because it quickly causes a person to lose consciousness. They note that Mr. Smith’s lawyers have themselves identified nitrogen hypoxia as preferable to Alabama’s troubled administration of lethal injection drugs.

Last week, a federal judge in Alabama rejected a request by Mr. Smith’s lawyers to halt the execution. Mr. Smith has appealed, and the case will most likely be appealed further to the U.S. Supreme Court, which in recent years has been reticent to halt executions at the last minute.

Mr. Smith, who responded to written questions via email, said he was worried that the procedure could go wrong.

”I am worried that we have told Alabama that these risks could happen — will happen — just like we warned them last year,” he said. “And they will do nothing to prevent these dangers from happening.”

The details of how the procedure is expected to unfold are outlined in a 40-page protocol document that Alabama issued last summer, the public version of which is heavily redacted.

What is known is that Mr. Smith will be led from his cell in the William C. Holman Correctional Facility to the prison’s death chamber. The complex is in Atmore, Ala., about 55 miles northeast of Mobile, and five reporters will be allowed to witness the execution. Mr. Smith will be put on a gurney and a mask will be placed over his face, and then he will be given two minutes to say his last words. Then, the prison warden or an assistant will initiate the pumping of the gas into Mr. Smith’s mask for at least 15 minutes.

There are few people who have intimate knowledge of what an execution by nitrogen hypoxia might look like. However, one of them is Dr. Philip Nitschke, a pioneer in assisted suicide who recently invented a pod that fills with nitrogen as a way for people to end their lives.

Dr. Nitschke estimates he has witnessed at least 50 deaths by nitrogen hypoxia. He was called to testify by Mr. Smith’s lawyers in December during their effort to block the execution, and he met with Mr. Smith. After visiting the Alabama execution chamber and examining the mask that will be used by the state for Mr. Smith’s death, Dr. Nitschke said in an interview that he could imagine scenarios ranging from a quick and painless death to one involving substantial suffering if things were to go wrong.

He said that the big difference between Alabama’s protocols and those of his assisted suicide work in Europe and Australia lies in Alabama’s plan to use a mask. He said it would create a higher chance of there being a leak — allowing oxygen in and prolonging the process — than a room, pod or a plastic bag would.

“I feel anxious about Kenny, and I just don’t know which way things are going to go,” Dr. Nitschke said of Mr. Smith, whom he said seemed very nervous when the two met.

“What he would’ve liked to hear from me,” Dr. Nitschke said, “was that this was going to work well.” But, he said, he did not feel that he could promise Mr. Smith as much, instead viewing Alabama’s protocols as a “quick and nasty” attempt at nitrogen hypoxia that ignores the potential dangers of vomiting and air leakage.

In the room during the execution will be Mr. Smith’s spiritual adviser, the Rev. Jeff Hood, who lives in Little Rock, Ark. He began speaking with Mr. Smith in November, developing what he describes as a close bond, and planned to be present during the execution.

Mr. Hood said in an interview that he was fearful of what Mr. Smith might have to endure, and he raised the possibility that Mr. Smith might physically resist the execution attempt.

“This is not going to be a peaceful experiment,” Mr. Hood said, adding: “I think it’s important for people to realize, when you strap someone down like that, you can’t expect someone who’s choking to death — suffocating to death — to not resist.”

Mr. Hood said he was also worried about his own safety, noting that prison officials required him to sign a waiver that warns about the potential hazards of nitrogen and to stay three feet away from Mr. Smith while he is wearing the mask.

Mr. Smith is facing execution for the 1988 stabbing murder of Elizabeth Sennett, after testimony that Ms. Sennett’s husband, a pastor, had offered to pay Mr. Smith and two other men $1,000 each to kill her. (The pastor, Charles Sennett Sr., later killed himself.) The jurors who convicted Mr. Smith voted 11 to 1 to spare his life and instead to sentence him to life in prison, but a judge overruled them and condemned him to death. In 2017, Alabama stopped allowing judges to overrule death penalty juries in such a way, and such rulings are no longer allowed anywhere in the United States.

Mr. Smith said that he did not believe that it was just for the judge to override the jury’s sentence in his case. Since the failed execution attempt, Mr. Smith said, he had struggled with severe anxiety and depression.

To Ms. Sennett’s sons, the execution cannot come soon enough — particularly after the botched attempt in 2022 — and they have said that the novel method was of little concern to them.

“Some of these people out there say, ‘Well, he doesn’t need to suffer like that,’” one son, Charles Sennett Jr., told WAAY 31 television station. “Well, he didn’t ask Mama how to suffer. They just did it. They stabbed her multiple times.”

Mr. Sennett said that he and other family members planned to attend the execution.

Another son, Michael Sennett, told NBC News last month that he was frustrated that the state had taken so long to carry out an execution that the judge ordered decades ago.

“It doesn’t matter to me how he goes out, so long as he goes,” he said, noting that Mr. Smith had been in prison “twice as long as I knew my mom.”

A slew of botched executions in Alabama, including that of Mr. Smith, led the state’s governor, Kay Ivey, a Republican, to order a temporary pause in executions while prison officials reviewed their procedures. Ms. Ivey lifted the pause after a few months, with prison officials describing some minor changes and a new rule allowing the state more time to carry out executions.

Since executions resumed, the state has killed two death row prisoners and has not had the kind of problems that plagued its previous attempts.

Polling has consistently showed that a slight majority of Americans support the death penalty, with a sharp divide along political lines. Most Republicans (81 percent) and just 32 percent of Democrats support the death penalty for people convicted of murder, according to one Gallup poll last year.

Still, executions have declined significantly since the modern peak of 98 carried out in 1999. Last year, states executed 24 people, and the federal government has played an increased role in recent years. The Trump administration put to death 13 people by lethal injection, the first executions by the federal government since George W. Bush was president.

Last week, the Justice Department under President Joe Biden, who campaigned on ending the federal death penalty, said it would seek the death penalty against a white gunman who killed 10 Black people in a racist attack on a supermarket in Buffalo.

Anna Betts contributed reporting.